提交 5ff23847 authored 作者: Thomas Mueller's avatar Thomas Mueller

MVStore: table engine

上级 fa09b19c
...@@ -34,7 +34,7 @@ public class MVPrimaryIndex extends BaseIndex { ...@@ -34,7 +34,7 @@ public class MVPrimaryIndex extends BaseIndex {
protected final MVTable mvTable; protected final MVTable mvTable;
protected MVMap<Long, Value[]> map; protected MVMap<Long, Value[]> map;
private long nextKey; private long lastKey;
private int mainIndexColumn = -1; private int mainIndexColumn = -1;
public MVPrimaryIndex(Database db, MVTable table, int id, IndexColumn[] columns, public MVPrimaryIndex(Database db, MVTable table, int id, IndexColumn[] columns,
...@@ -50,7 +50,7 @@ public class MVPrimaryIndex extends BaseIndex { ...@@ -50,7 +50,7 @@ public class MVPrimaryIndex extends BaseIndex {
map = new MVMap<Long, Value[]>(new ObjectDataType(), t); map = new MVMap<Long, Value[]>(new ObjectDataType(), t);
map = table.getStore().openMap(getName() + "_" + getId(), map); map = table.getStore().openMap(getName() + "_" + getId(), map);
Long k = map.lastKey(); Long k = map.lastKey();
nextKey = k == null ? 0 : k + 1; lastKey = k == null ? 0 : k;
} }
public void renameTable(String newName) { public void renameTable(String newName) {
...@@ -82,7 +82,9 @@ public class MVPrimaryIndex extends BaseIndex { ...@@ -82,7 +82,9 @@ public class MVPrimaryIndex extends BaseIndex {
@Override @Override
public void add(Session session, Row row) { public void add(Session session, Row row) {
if (mainIndexColumn == -1) { if (mainIndexColumn == -1) {
row.setKey(nextKey++); if (row.getKey() == 0) {
row.setKey(++lastKey);
}
} else { } else {
Long c = row.getValue(mainIndexColumn).getLong(); Long c = row.getValue(mainIndexColumn).getLong();
row.setKey(c); row.setKey(c);
......
...@@ -46,7 +46,6 @@ public class MVTable extends TableBase { ...@@ -46,7 +46,6 @@ public class MVTable extends TableBase {
private final String storeName; private final String storeName;
private final MVStore store; private final MVStore store;
private final boolean hidden;
private MVPrimaryIndex primaryIndex; private MVPrimaryIndex primaryIndex;
private ArrayList<Index> indexes = New.arrayList(); private ArrayList<Index> indexes = New.arrayList();
private long lastModificationId; private long lastModificationId;
...@@ -66,7 +65,7 @@ public class MVTable extends TableBase { ...@@ -66,7 +65,7 @@ public class MVTable extends TableBase {
super(data); super(data);
this.storeName = storeName; this.storeName = storeName;
this.store = store; this.store = store;
this.hidden = data.isHidden; this.isHidden = data.isHidden;
traceLock = database.getTrace(Trace.LOCK); traceLock = database.getTrace(Trace.LOCK);
} }
...@@ -305,11 +304,6 @@ public class MVTable extends TableBase { ...@@ -305,11 +304,6 @@ public class MVTable extends TableBase {
} }
} }
@Override
public boolean isHidden() {
return hidden;
}
@Override @Override
public boolean canTruncate() { public boolean canTruncate() {
// TODO copy & pasted source code from RegularTable // TODO copy & pasted source code from RegularTable
......
...@@ -556,16 +556,16 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1` ...@@ -556,16 +556,16 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
beforeTest(); beforeTest();
// db // db
// new TestScriptSimple().runTest(this); new TestScriptSimple().runTest(this);
new TestScript().runTest(this); new TestScript().runTest(this);
new TestAlter().runTest(this); new TestAlter().runTest(this);
new TestAlterSchemaRename().runTest(this); new TestAlterSchemaRename().runTest(this);
new TestAutoRecompile().runTest(this); new TestAutoRecompile().runTest(this);
new TestBitField().runTest(this); new TestBitField().runTest(this);
// new TestBackup().runTest(this); new TestBackup().runTest(this);
new TestBigDb().runTest(this); new TestBigDb().runTest(this);
new TestBigResult().runTest(this); new TestBigResult().runTest(this);
new TestCases().runTest(this); // <<= new TestCases().runTest(this);
new TestCheckpoint().runTest(this); new TestCheckpoint().runTest(this);
new TestCluster().runTest(this); new TestCluster().runTest(this);
new TestCompatibility().runTest(this); new TestCompatibility().runTest(this);
...@@ -630,7 +630,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1` ...@@ -630,7 +630,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
new TestLimitUpdates().runTest(this); new TestLimitUpdates().runTest(this);
new TestLobApi().runTest(this); new TestLobApi().runTest(this);
new TestManyJdbcObjects().runTest(this); new TestManyJdbcObjects().runTest(this);
new TestMetaData().runTest(this); // <<= new TestMetaData().runTest(this);
new TestNativeSQL().runTest(this); new TestNativeSQL().runTest(this);
new TestPreparedStatement().runTest(this); new TestPreparedStatement().runTest(this);
new TestResultSet().runTest(this); new TestResultSet().runTest(this);
......
db1 = H2, org.h2.Driver, jdbc:h2:data/test;LOCK_TIMEOUT=10000;LOCK_MODE=3, sa, sa db1 = H2, org.h2.Driver, jdbc:h2:data/test;LOCK_TIMEOUT=10000;LOCK_MODE=3, sa, sa
#xdb1 = H2, org.h2.Driver, jdbc:h2:data/test;LOCK_TIMEOUT=10000;LOCK_MODE=3;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine, sa, sa #xdb1 = H2, org.h2.Driver, jdbc:h2:data/test;LOCK_TIMEOUT=10000;LOCK_MODE=3;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine, sa, sa
#xdb1 = H2, org.h2.Driver, jdbc:h2:data/test;LOG=1;LOCK_TIMEOUT=10000;LOCK_MODE=3;ACCESS_MODE_DATA=rwd, sa, sa #xdb1 = H2, org.h2.Driver, jdbc:h2:data/test;LOG=1;LOCK_TIMEOUT=10000;LOCK_MODE=3;ACCESS_MODE_DATA=rwd, sa, sa
#xdb2 = H2 (nio), org.h2.Driver, jdbc:h2:nio:data/test;LOCK_TIMEOUT=10000;LOCK_MODE=3, sa, sa #xdb2 = H2 (nio), org.h2.Driver, jdbc:h2:nio:data/test;LOCK_TIMEOUT=10000;LOCK_MODE=3, sa, sa
#xdb3 = H2 (nioMapped), org.h2.Driver, jdbc:h2:nioMapped:data/test;LOCK_TIMEOUT=10000;LOCK_MODE=3, sa, sa #xdb3 = H2 (nioMapped), org.h2.Driver, jdbc:h2:nioMapped:data/test;LOCK_TIMEOUT=10000;LOCK_MODE=3, sa, sa
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论