提交 648bb0ec authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Remove MVCC code from cursors and pages in PageStore

上级 931d3924
......@@ -131,11 +131,9 @@ abstract class PageData extends Page {
* @param session the session
* @param minKey the smallest key
* @param maxKey the largest key
* @param multiVersion if the delta should be used
* @return the cursor
*/
abstract Cursor find(Session session, long minKey, long maxKey,
boolean multiVersion);
abstract Cursor find(Session session, long minKey, long maxKey);
/**
* Get the key at this position.
......
......@@ -5,7 +5,6 @@
*/
package org.h2.index;
import org.h2.engine.Session;
import org.h2.message.DbException;
import org.h2.result.Row;
import org.h2.result.SearchRow;
......@@ -19,16 +18,11 @@ class PageDataCursor implements Cursor {
private int idx;
private final long maxKey;
private Row row;
private final boolean multiVersion;
private final Session session;
PageDataCursor(Session session, PageDataLeaf current, int idx, long maxKey,
boolean multiVersion) {
PageDataCursor(PageDataLeaf current, int idx, long maxKey) {
this.current = current;
this.idx = idx;
this.maxKey = maxKey;
this.multiVersion = multiVersion;
this.session = session;
}
@Override
......@@ -43,18 +37,7 @@ class PageDataCursor implements Cursor {
@Override
public boolean next() {
if (!multiVersion) {
nextRow();
return checkMax();
}
while (true) {
nextRow();
if (row != null && row.getSessionId() != 0 &&
row.getSessionId() != session.getId()) {
continue;
}
break;
}
nextRow();
return checkMax();
}
......
......@@ -252,7 +252,7 @@ public class PageDataIndex extends PageIndex {
long from = first == null ? Long.MIN_VALUE : first.getKey();
long to = last == null ? Long.MAX_VALUE : last.getKey();
PageData root = getPage(rootPageId, 0);
return root.find(session, from, to, isMultiVersion);
return root.find(session, from, to);
}
......@@ -262,12 +262,11 @@ public class PageDataIndex extends PageIndex {
* @param session the session
* @param first the key of the first row
* @param last the key of the last row
* @param multiVersion if mvcc should be used
* @return the cursor
*/
Cursor find(Session session, long first, long last, boolean multiVersion) {
Cursor find(Session session, long first, long last) {
PageData root = getPage(rootPageId, 0);
return root.find(session, first, last, multiVersion);
return root.find(session, first, last);
}
@Override
......
......@@ -315,9 +315,9 @@ public class PageDataLeaf extends PageData {
}
@Override
Cursor find(Session session, long minKey, long maxKey, boolean multiVersion) {
Cursor find(Session session, long minKey, long maxKey) {
int x = find(minKey);
return new PageDataCursor(session, this, x, maxKey, multiVersion);
return new PageDataCursor(this, x, maxKey);
}
/**
......
......@@ -160,11 +160,10 @@ public class PageDataNode extends PageData {
}
@Override
Cursor find(Session session, long minKey, long maxKey, boolean multiVersion) {
Cursor find(Session session, long minKey, long maxKey) {
int x = find(minKey);
int child = childPageIds[x];
return index.getPage(child, getPos()).find(session, minKey, maxKey,
multiVersion);
return index.getPage(child, getPos()).find(session, minKey, maxKey);
}
@Override
......
......@@ -67,17 +67,17 @@ public class PageDelegateIndex extends PageIndex {
// ifNull is MIN_VALUE as well, because the column is never NULL
// so avoid returning all rows (returning one row is OK)
long max = mainIndex.getKey(last, Long.MAX_VALUE, Long.MIN_VALUE);
return mainIndex.find(session, min, max, false);
return mainIndex.find(session, min, max);
}
@Override
public Cursor findFirstOrLast(Session session, boolean first) {
Cursor cursor;
if (first) {
cursor = mainIndex.find(session, Long.MIN_VALUE, Long.MAX_VALUE, false);
cursor = mainIndex.find(session, Long.MIN_VALUE, Long.MAX_VALUE);
} else {
long x = mainIndex.getLastKey();
cursor = mainIndex.find(session, x, x, false);
cursor = mainIndex.find(session, x, x);
}
cursor.next();
return cursor;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论