提交 3733388a authored 作者: Thomas Mueller's avatar Thomas Mueller

Multi-threaded kernel: concurrently running an online backup and updating the…

Multi-threaded kernel: concurrently running an online backup and updating the database resulted in a broken (transactionally incorrect) backup file in some cases.
上级 d3fee387
...@@ -196,6 +196,7 @@ public class PageStore implements CacheWriter { ...@@ -196,6 +196,7 @@ public class PageStore implements CacheWriter {
private int logMode = LOG_MODE_SYNC; private int logMode = LOG_MODE_SYNC;
private boolean lockFile; private boolean lockFile;
private boolean readMode; private boolean readMode;
private int backupLevel;
/** /**
* Create a new page store object. * Create a new page store object.
...@@ -412,8 +413,9 @@ public class PageStore implements CacheWriter { ...@@ -412,8 +413,9 @@ public class PageStore implements CacheWriter {
*/ */
public synchronized void checkpoint() { public synchronized void checkpoint() {
trace.debug("checkpoint"); trace.debug("checkpoint");
if (log == null || readMode || database.isReadOnly()) { if (log == null || readMode || database.isReadOnly() || backupLevel > 0) {
// the file was never fully opened // the file was never fully opened, or is read-only,
// or checkpoint is currently disabled
return; return;
} }
database.checkPowerOff(); database.checkPowerOff();
...@@ -1941,4 +1943,8 @@ public class PageStore implements CacheWriter { ...@@ -1941,4 +1943,8 @@ public class PageStore implements CacheWriter {
return systemSession; return systemSession;
} }
public synchronized void setBackup(boolean start) {
backupLevel += start ? 1 : -1;
}
} }
...@@ -412,7 +412,7 @@ public abstract class TestBase { ...@@ -412,7 +412,7 @@ public abstract class TestBase {
* @throws AssertionError always throws an AssertionError * @throws AssertionError always throws an AssertionError
*/ */
public void fail() { public void fail() {
fail("Unexpected success"); fail("Failure");
} }
/** /**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论