提交 0442a328 authored 作者: Thomas Mueller's avatar Thomas Mueller

MVTableEngine: in-memory operation

上级 b22ed608
......@@ -1832,9 +1832,9 @@ public class Database implements DataHandler {
}
if (mvStore != null) {
mvStore.prepareCommit(session, transaction);
pageStore.flushLog();
return;
}
pageStore.flushLog();
pageStore.prepareCommit(session, transaction);
}
......
......@@ -893,7 +893,8 @@ public class MVMap<K, V> extends AbstractMap<K, V>
}
// create a new instance
// because another thread might iterate over it
ArrayList<Page> list = new ArrayList<Page>();
int size = oldRoots.size() - i;
ArrayList<Page> list = new ArrayList<Page>(size);
list.addAll(oldRoots.subList(i, oldRoots.size()));
oldRoots = list;
}
......
......@@ -19,6 +19,7 @@ import org.h2.engine.Database;
import org.h2.engine.Session;
import org.h2.message.DbException;
import org.h2.mvstore.DataUtils;
import org.h2.mvstore.FileStore;
import org.h2.mvstore.MVStore;
import org.h2.mvstore.db.TransactionStore.Transaction;
import org.h2.store.InDoubtTransaction;
......@@ -167,7 +168,8 @@ public class MVTableEngine implements TableEngine {
* Store all pending changes.
*/
public void store() {
if (store.getFileStore().isReadOnly()) {
FileStore s = store.getFileStore();
if (s == null || s.isReadOnly()) {
return;
}
store.commit();
......@@ -210,7 +212,9 @@ public class MVTableEngine implements TableEngine {
Transaction t = session.getTransaction();
t.setName(transactionName);
t.prepare();
store.store();
if (store.getFileStore() != null) {
store.store();
}
}
public ArrayList<InDoubtTransaction> getInDoubtTransactions() {
......@@ -307,7 +311,9 @@ public class MVTableEngine implements TableEngine {
} else {
transaction.rollback();
}
store.store();
if (store.getFileStore() != null) {
store.store();
}
this.state = state;
}
......
......@@ -190,8 +190,10 @@ public class TransactionStore {
private void commitIfNeeded() {
if (store.getUnsavedPageCount() > MAX_UNSAVED_PAGES) {
store.commit();
store.store();
if (store.getFileStore() != null) {
store.commit();
store.store();
}
}
}
......@@ -352,6 +354,9 @@ public class TransactionStore {
firstOpenTransaction = -1;
}
if (store.getWriteDelay() == 0) {
if (store.getFileStore() == null) {
return;
}
store.commit();
}
// to avoid having to store the transaction log,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论