提交 a6d143e4 authored 作者: Andrei Tokar's avatar Andrei Tokar

add assertion to ensure that possible left-over saved map is not picked up by new index

上级 16caf1d4
...@@ -54,6 +54,7 @@ public class MVPrimaryIndex extends BaseIndex { ...@@ -54,6 +54,7 @@ public class MVPrimaryIndex extends BaseIndex {
ValueDataType keyType = new ValueDataType(); ValueDataType keyType = new ValueDataType();
ValueDataType valueType = new ValueDataType(db, sortTypes); ValueDataType valueType = new ValueDataType(db, sortTypes);
mapName = "table." + getId(); mapName = "table." + getId();
assert db.isStarting() || !db.getStore().getMvStore().getMetaMap().containsKey("name." + mapName);
Transaction t = mvTable.getTransactionBegin(); Transaction t = mvTable.getTransactionBegin();
dataMap = t.openMap(mapName, keyType, valueType); dataMap = t.openMap(mapName, keyType, valueType);
dataMap.map.setVolatile(!table.isPersistData() || !indexType.isPersistent()); dataMap.map.setVolatile(!table.isPersistData() || !indexType.isPersistent());
......
...@@ -58,6 +58,7 @@ public final class MVSecondaryIndex extends BaseIndex implements MVIndex { ...@@ -58,6 +58,7 @@ public final class MVSecondaryIndex extends BaseIndex implements MVIndex {
// even for unique indexes, as some of the index columns could be null // even for unique indexes, as some of the index columns could be null
keyColumns = columns.length + 1; keyColumns = columns.length + 1;
String mapName = "index." + getId(); String mapName = "index." + getId();
assert db.isStarting() || !db.getStore().getMvStore().getMetaMap().containsKey("name." + mapName);
int[] sortTypes = new int[keyColumns]; int[] sortTypes = new int[keyColumns];
for (int i = 0; i < columns.length; i++) { for (int i = 0; i < columns.length; i++) {
sortTypes[i] = columns[i].sortType; sortTypes[i] = columns[i].sortType;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论