提交 0c9a16b0 authored 作者: Andrei Tokar's avatar Andrei Tokar

roll back special handling of meta table on index opening

上级 f830ad95
...@@ -844,9 +844,15 @@ public class Database implements DataHandler { ...@@ -844,9 +844,15 @@ public class Database implements DataHandler {
} }
} }
private void handleUpgradeIssues() { private void handleUpgradeIssues() {
if (mvStore != null && !isReadOnly()) { if (mvStore != null && !isReadOnly()) {
MVStore store = mvStore.getStore(); MVStore store = mvStore.getStore();
// Version 1.4.197 erroneously handles index on SYS_ID.ID as secondary
// and does not delegate to scan index as it should.
// This code will try to fix that by converging ROW_ID and ID,
// since they may have got out of sync, and by removing map "index.0",
// which corresponds to a secondary index.
if (store.hasMap("index.0")) { if (store.hasMap("index.0")) {
Index scanIndex = meta.getScanIndex(systemSession); Index scanIndex = meta.getScanIndex(systemSession);
Cursor curs = scanIndex.find(systemSession, null, null); Cursor curs = scanIndex.find(systemSession, null, null);
......
...@@ -506,8 +506,8 @@ public class MVTable extends TableBase { ...@@ -506,8 +506,8 @@ public class MVTable extends TableBase {
int mainIndexColumn = primaryIndex.getMainIndexColumn() != SearchRow.ROWID_INDEX int mainIndexColumn = primaryIndex.getMainIndexColumn() != SearchRow.ROWID_INDEX
? SearchRow.ROWID_INDEX : getMainIndexColumn(indexType, cols); ? SearchRow.ROWID_INDEX : getMainIndexColumn(indexType, cols);
if (database.isStarting()) { if (database.isStarting()) {
// if this is not "SYS_ID" table and index does exists as a separate map // if index does exists as a separate map it can't be a delegate
if (indexId != 0 && transactionStore.hasMap("index." + indexId)) { if (transactionStore.hasMap("index." + indexId)) {
// we can not reuse primary index // we can not reuse primary index
mainIndexColumn = SearchRow.ROWID_INDEX; mainIndexColumn = SearchRow.ROWID_INDEX;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论