提交 58d6c9a0 authored 作者: Thomas Mueller's avatar Thomas Mueller

MVStore bugfixes

上级 d056ce9c
...@@ -549,17 +549,6 @@ public class MVStore { ...@@ -549,17 +549,6 @@ public class MVStore {
// remove this chunk in the next save operation // remove this chunk in the next save operation
registerFreePage(currentVersion, c.id, 0, 0); registerFreePage(currentVersion, c.id, 0, 0);
} }
if (c.id > lastChunkId) {
System.out.println("strange!");
}
lastChunkId = Math.max(c.id, lastChunkId);
if (c.start == Long.MAX_VALUE) {
;;
System.out.println("??");
continue;
}
int len = MathUtils.roundUpInt(c.length, BLOCK_SIZE) + BLOCK_SIZE; int len = MathUtils.roundUpInt(c.length, BLOCK_SIZE) + BLOCK_SIZE;
fileStore.markUsed(c.start, len); fileStore.markUsed(c.start, len);
} }
...@@ -1221,6 +1210,11 @@ public class MVStore { ...@@ -1221,6 +1210,11 @@ public class MVStore {
// now re-use the empty space // now re-use the empty space
reuseSpace = true; reuseSpace = true;
for (Chunk c : move) { for (Chunk c : move) {
if (!chunks.containsKey(c.id)) {
// already removed during the
// previous store operation
continue;
}
ByteBuffer buff = getWriteBuffer(); ByteBuffer buff = getWriteBuffer();
int length = MathUtils.roundUpInt(c.length, BLOCK_SIZE) + BLOCK_SIZE; int length = MathUtils.roundUpInt(c.length, BLOCK_SIZE) + BLOCK_SIZE;
buff = DataUtils.ensureCapacity(buff, length); buff = DataUtils.ensureCapacity(buff, length);
......
...@@ -698,7 +698,7 @@ public class Page { ...@@ -698,7 +698,7 @@ public class Page {
if (pageLength > maxLength) { if (pageLength > maxLength) {
throw DataUtils.newIllegalStateException( throw DataUtils.newIllegalStateException(
DataUtils.ERROR_FILE_CORRUPT, DataUtils.ERROR_FILE_CORRUPT,
"File corrupted, expected length =< {0}, got {1}", "File corrupted, expected page length =< {0}, got {1}",
maxLength, pageLength); maxLength, pageLength);
} }
short check = buff.getShort(); short check = buff.getShort();
......
...@@ -198,5 +198,4 @@ public class TestRandomMapOps extends TestBase { ...@@ -198,5 +198,4 @@ public class TestRandomMapOps extends TestBase {
// System.out.println(msg + "; // op " + op); // System.out.println(msg + "; // op " + op);
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论