提交 aa9a2312 authored 作者: andrei's avatar andrei

encapsulate TransactionStore.store field in preparation to a move into a…

encapsulate TransactionStore.store field in preparation to a move into a separate package  and susequent split
上级 80050699
...@@ -515,7 +515,7 @@ public class MVTable extends TableBase { ...@@ -515,7 +515,7 @@ public class MVTable extends TableBase {
int mainIndexColumn; int mainIndexColumn;
mainIndexColumn = getMainIndexColumn(indexType, cols); mainIndexColumn = getMainIndexColumn(indexType, cols);
if (database.isStarting()) { if (database.isStarting()) {
if (transactionStore.store.hasMap("index." + indexId)) { if (transactionStore.hasMap("index." + indexId)) {
mainIndexColumn = -1; mainIndexColumn = -1;
} }
} else if (primaryIndex.getRowCountMax() != 0) { } else if (primaryIndex.getRowCountMax() != 0) {
......
...@@ -266,17 +266,11 @@ public class MVTableEngine implements TableEngine { ...@@ -266,17 +266,11 @@ public class MVTableEngine implements TableEngine {
public void removeTemporaryMaps(BitSet objectIds) { public void removeTemporaryMaps(BitSet objectIds) {
for (String mapName : store.getMapNames()) { for (String mapName : store.getMapNames()) {
if (mapName.startsWith("temp.")) { if (mapName.startsWith("temp.")) {
MVMap<?, ?> map = store.openMap(mapName); store.removeMap(mapName);
store.removeMap(map);
} else if (mapName.startsWith("table.") || mapName.startsWith("index.")) { } else if (mapName.startsWith("table.") || mapName.startsWith("index.")) {
int id = Integer.parseInt(mapName.substring(1 + mapName.indexOf('.'))); int id = Integer.parseInt(mapName.substring(1 + mapName.indexOf('.')));
if (!objectIds.get(id)) { if (!objectIds.get(id)) {
ValueDataType keyType = new ValueDataType(null, null, null); store.removeMap(mapName);
ValueDataType valueType = new ValueDataType(null, null, null);
Transaction t = transactionStore.begin();
TransactionMap<?, ?> m = t.openMap(mapName, keyType, valueType);
transactionStore.removeMap(m);
t.commit();
} }
} }
} }
......
...@@ -148,6 +148,16 @@ public class TransactionStore { ...@@ -148,6 +148,16 @@ public class TransactionStore {
this.maxTransactionId = max; this.maxTransactionId = max;
} }
/**
* Check whether a given map exists.
*
* @param name the map name
* @return true if it exists
*/
public boolean hasMap(String name) {
return store.hasMap(name);
}
/** /**
* Combine the transaction id and the log id to an operation id. * Combine the transaction id and the log id to an operation id.
* *
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论