提交 49e695e6 authored 作者: Thomas Mueller's avatar Thomas Mueller

Page store: bugfix and more internal checks

上级 0b0d8136
......@@ -122,8 +122,11 @@ public class PageFreeList extends Page {
int allocate(int pageId) throws SQLException {
int idx = pageId - getPos();
if (idx >= 0 && !used.get(idx)) {
store.logUndo(this, data);
// set the bit first, because logUndo can
// allocate other pages, and we must not
// return the same page twice
used.set(idx);
store.logUndo(this, data);
store.update(this);
}
return pageId;
......
......@@ -1018,8 +1018,9 @@ public class PageStore implements CacheWriter {
}
for (Index openIndex : metaObjects.values()) {
if (openIndex.getTable().isTemporary()) {
openIndex.truncate(systemSession);
openIndex.remove(systemSession);
this.removeMetaIndex(openIndex, systemSession);
removeMetaIndex(openIndex, systemSession);
}
openIndex.close(systemSession);
}
......@@ -1356,7 +1357,11 @@ public class PageStore implements CacheWriter {
}
private void removeMetaIndex(Index index, Session session) throws SQLException {
Row row = metaIndex.getRow(session, index.getId() + 1);
int key = index.getId() + 1;
Row row = metaIndex.getRow(session, key);
if (row.getKey() != key) {
Message.throwInternalError();
}
metaIndex.remove(session, row);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论