Unverified 提交 0462af5c authored 作者: Noel Grandin's avatar Noel Grandin 提交者: GitHub

Merge pull request #1471 from grandinj/bug1350_freeListPagesPerList

issue 1350: TestCrashAPI: PageStore.freeListPagesPerList
...@@ -549,6 +549,7 @@ public class Database implements DataHandler { ...@@ -549,6 +549,7 @@ public class Database implements DataHandler {
if (store != null) { if (store != null) {
store.closeImmediately(); store.closeImmediately();
} }
synchronized(this) {
if (pageStore != null) { if (pageStore != null) {
try { try {
pageStore.close(); pageStore.close();
...@@ -557,6 +558,7 @@ public class Database implements DataHandler { ...@@ -557,6 +558,7 @@ public class Database implements DataHandler {
} }
pageStore = null; pageStore = null;
} }
}
if (lock != null) { if (lock != null) {
stopServer(); stopServer();
if (fileLockMethod != FileLockMethod.SERIALIZED) { if (fileLockMethod != FileLockMethod.SERIALIZED) {
...@@ -2664,6 +2666,7 @@ public class Database implements DataHandler { ...@@ -2664,6 +2666,7 @@ public class Database implements DataHandler {
} }
return null; return null;
} }
synchronized (this) {
if (pageStore == null) { if (pageStore == null) {
pageStore = new PageStore(this, databaseName + pageStore = new PageStore(this, databaseName +
Constants.SUFFIX_PAGE_FILE, accessModeData, cacheSize); Constants.SUFFIX_PAGE_FILE, accessModeData, cacheSize);
...@@ -2678,6 +2681,7 @@ public class Database implements DataHandler { ...@@ -2678,6 +2681,7 @@ public class Database implements DataHandler {
} }
return pageStore; return pageStore;
} }
}
/** /**
* Get the first user defined table, excluding the LOB_BLOCKS table that the * Get the first user defined table, excluding the LOB_BLOCKS table that the
...@@ -2925,6 +2929,11 @@ public class Database implements DataHandler { ...@@ -2925,6 +2929,11 @@ public class Database implements DataHandler {
if (log < 0 || log > 2) { if (log < 0 || log > 2) {
throw DbException.getInvalidValueException("LOG", log); throw DbException.getInvalidValueException("LOG", log);
} }
if (store != null) {
this.logMode = log;
return;
}
synchronized (this) {
if (pageStore != null) { if (pageStore != null) {
if (log != PageStore.LOG_MODE_SYNC || if (log != PageStore.LOG_MODE_SYNC ||
pageStore.getLogMode() != PageStore.LOG_MODE_SYNC) { pageStore.getLogMode() != PageStore.LOG_MODE_SYNC) {
...@@ -2935,17 +2944,17 @@ public class Database implements DataHandler { ...@@ -2935,17 +2944,17 @@ public class Database implements DataHandler {
this.logMode = log; this.logMode = log;
pageStore.setLogMode(log); pageStore.setLogMode(log);
} }
if (store != null) {
this.logMode = log;
} }
} }
public int getLogMode() { public int getLogMode() {
if (store != null) {
return logMode;
}
synchronized (this) {
if (pageStore != null) { if (pageStore != null) {
return pageStore.getLogMode(); return pageStore.getLogMode();
} }
if (store != null) {
return logMode;
} }
return PageStore.LOG_MODE_OFF; return PageStore.LOG_MODE_OFF;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论