提交 e8b84983 authored 作者: Thomas Mueller's avatar Thomas Mueller

LOG=0 is now a bit faster (previously undo log entries were still written).

上级 3cd2ac16
...@@ -835,11 +835,11 @@ public class PageStore implements CacheWriter { ...@@ -835,11 +835,11 @@ public class PageStore implements CacheWriter {
} }
public void writeBack(CacheObject obj) { public void writeBack(CacheObject obj) {
synchronized (database) {
Page record = (Page) obj; Page record = (Page) obj;
if (trace.isDebugEnabled()) { if (trace.isDebugEnabled()) {
trace.debug("writeBack " + record); trace.debug("writeBack " + record);
} }
synchronized (database) {
record.write(); record.write();
record.setChanged(false); record.setChanged(false);
} }
...@@ -852,12 +852,10 @@ public class PageStore implements CacheWriter { ...@@ -852,12 +852,10 @@ public class PageStore implements CacheWriter {
* @param old the old data (if known) or null * @param old the old data (if known) or null
*/ */
public void logUndo(Page page, Data old) { public void logUndo(Page page, Data old) {
synchronized (database) { if (logMode == LOG_MODE_OFF) {
if (trace.isDebugEnabled()) { return;
// if (!record.isChanged()) {
// trace.debug("logUndo " + record.toString());
// }
} }
synchronized (database) {
checkOpen(); checkOpen();
database.checkWritingAllowed(); database.checkWritingAllowed();
if (!recoveryRunning) { if (!recoveryRunning) {
...@@ -890,8 +888,10 @@ public class PageStore implements CacheWriter { ...@@ -890,8 +888,10 @@ public class PageStore implements CacheWriter {
int pos = page.getPos(); int pos = page.getPos();
if (SysProperties.CHECK && !recoveryRunning) { if (SysProperties.CHECK && !recoveryRunning) {
// ensure the undo entry is already written // ensure the undo entry is already written
if (logMode != LOG_MODE_OFF) {
log.addUndo(pos, null); log.addUndo(pos, null);
} }
}
allocatePage(pos); allocatePage(pos);
cache.update(pos, page); cache.update(pos, page);
} }
...@@ -976,8 +976,10 @@ public class PageStore implements CacheWriter { ...@@ -976,8 +976,10 @@ public class PageStore implements CacheWriter {
public int allocatePage() { public int allocatePage() {
int pos = allocatePage(null, 0); int pos = allocatePage(null, 0);
if (!recoveryRunning) { if (!recoveryRunning) {
if (logMode != LOG_MODE_OFF) {
log.addUndo(pos, emptyPage); log.addUndo(pos, emptyPage);
} }
}
return pos; return pos;
} }
...@@ -1045,8 +1047,10 @@ public class PageStore implements CacheWriter { ...@@ -1045,8 +1047,10 @@ public class PageStore implements CacheWriter {
cache.remove(pageId); cache.remove(pageId);
if (SysProperties.CHECK && !recoveryRunning && undo) { if (SysProperties.CHECK && !recoveryRunning && undo) {
// ensure the undo entry is already written // ensure the undo entry is already written
if (logMode != LOG_MODE_OFF) {
log.addUndo(pageId, null); log.addUndo(pageId, null);
} }
}
freePage(pageId); freePage(pageId);
if (recoveryRunning) { if (recoveryRunning) {
writePage(pageId, createData()); writePage(pageId, createData());
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论