Unverified 提交 54d024aa authored 作者: Andrei Tokar's avatar Andrei Tokar 提交者: GitHub

Merge pull request #1044 from h2database/txcommit-atomic

Encapsulate TransactionStore.store field in preparation to a move
......@@ -515,7 +515,7 @@ public class MVTable extends TableBase {
int mainIndexColumn;
mainIndexColumn = getMainIndexColumn(indexType, cols);
if (database.isStarting()) {
if (transactionStore.store.hasMap("index." + indexId)) {
if (transactionStore.hasMap("index." + indexId)) {
mainIndexColumn = -1;
}
} else if (primaryIndex.getRowCountMax() != 0) {
......
......@@ -266,17 +266,11 @@ public class MVTableEngine implements TableEngine {
public void removeTemporaryMaps(BitSet objectIds) {
for (String mapName : store.getMapNames()) {
if (mapName.startsWith("temp.")) {
MVMap<?, ?> map = store.openMap(mapName);
store.removeMap(map);
store.removeMap(mapName);
} else if (mapName.startsWith("table.") || mapName.startsWith("index.")) {
int id = Integer.parseInt(mapName.substring(1 + mapName.indexOf('.')));
if (!objectIds.get(id)) {
ValueDataType keyType = new ValueDataType(null, null, null);
ValueDataType valueType = new ValueDataType(null, null, null);
Transaction t = transactionStore.begin();
TransactionMap<?, ?> m = t.openMap(mapName, keyType, valueType);
transactionStore.removeMap(m);
t.commit();
store.removeMap(mapName);
}
}
}
......
......@@ -148,6 +148,16 @@ public class TransactionStore {
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.
*
......@@ -893,7 +903,7 @@ public class TransactionStore {
/**
* The map id.
*/
final int mapId;
public final int mapId;
/**
* If a record was read that was updated by this transaction, and the
......@@ -1639,7 +1649,7 @@ public class TransactionStore {
* A versioned value (possibly null). It contains a pointer to the old
* value, and the value itself.
*/
static class VersionedValue {
public static class VersionedValue {
/**
* The operation id.
......@@ -1673,7 +1683,7 @@ public class TransactionStore {
private final DataType valueType;
VersionedValueType(DataType valueType) {
public VersionedValueType(DataType valueType) {
this.valueType = valueType;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论