提交 ea8fd10f authored 作者: Andrei Tokar's avatar Andrei Tokar

fix mixup of DEFRAG and COMPACT in MVStore move

上级 0ff4499b
...@@ -1521,12 +1521,12 @@ public class Database implements DataHandler { ...@@ -1521,12 +1521,12 @@ public class Database implements DataHandler {
reconnectModified(false); reconnectModified(false);
if (store != null && store.getMvStore() != null && !store.getMvStore().isClosed()) { if (store != null && store.getMvStore() != null && !store.getMvStore().isClosed()) {
long maxCompactTime = dbSettings.maxCompactTime; long maxCompactTime = dbSettings.maxCompactTime;
if (compactMode == CommandInterface.SHUTDOWN_COMPACT) { if (compactMode == CommandInterface.SHUTDOWN_COMPACT ||
store.compactFile(dbSettings.maxCompactTime); compactMode == CommandInterface.SHUTDOWN_DEFRAG ||
} else if (compactMode == CommandInterface.SHUTDOWN_DEFRAG) { getSettings().defragAlways) {
maxCompactTime = Long.MAX_VALUE;
} else if (getSettings().defragAlways) {
maxCompactTime = Long.MAX_VALUE; maxCompactTime = Long.MAX_VALUE;
} else {
store.compactFile(dbSettings.maxCompactTime);
} }
store.close(maxCompactTime); store.close(maxCompactTime);
} }
......
...@@ -740,8 +740,7 @@ public class TestMVTableEngine extends TestDb { ...@@ -740,8 +740,7 @@ public class TestMVTableEngine extends TestDb {
conn.close(); conn.close();
long sizeNew = FileUtils.size(getBaseDir() + "/" + getTestName() long sizeNew = FileUtils.size(getBaseDir() + "/" + getTestName()
+ Constants.SUFFIX_MV_FILE); + Constants.SUFFIX_MV_FILE);
println("new: " + sizeNew + " old: " + sizeOld); assertTrue("new: " + sizeNew + " old: " + sizeOld, sizeNew < sizeOld);
// assertTrue("new: " + sizeNew + " old: " + sizeOld, sizeNew < sizeOld);
} }
private void testTwoPhaseCommit() throws Exception { private void testTwoPhaseCommit() throws Exception {
...@@ -1436,7 +1435,7 @@ public class TestMVTableEngine extends TestDb { ...@@ -1436,7 +1435,7 @@ public class TestMVTableEngine extends TestDb {
reverse += testReverseDeletePerformance(true); reverse += testReverseDeletePerformance(true);
direct += testReverseDeletePerformance(false); direct += testReverseDeletePerformance(false);
} }
assertTrue("direct: " + direct + ", reverse: " + reverse, 2 * Math.abs(reverse - direct) < reverse + direct); assertTrue("direct: " + direct + ", reverse: " + reverse, 3 * Math.abs(reverse - direct) < 2 * (reverse + direct));
} }
private long testReverseDeletePerformance(boolean reverse) throws Exception { private long testReverseDeletePerformance(boolean reverse) throws Exception {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论