提交 7513daad authored 作者: Thomas Mueller's avatar Thomas Mueller

Remove unused code

上级 73112de8
...@@ -7,10 +7,8 @@ ...@@ -7,10 +7,8 @@
package org.h2.index; package org.h2.index;
import java.sql.SQLException; import java.sql.SQLException;
import org.h2.constant.ErrorCode; import org.h2.constant.ErrorCode;
import org.h2.constant.SysProperties; import org.h2.constant.SysProperties;
import org.h2.engine.Constants;
import org.h2.engine.Session; import org.h2.engine.Session;
import org.h2.message.Message; import org.h2.message.Message;
import org.h2.result.Row; import org.h2.result.Row;
...@@ -90,11 +88,6 @@ public class BtreeLeaf extends BtreePage { ...@@ -90,11 +88,6 @@ public class BtreeLeaf extends BtreePage {
SearchRow remove(Session session, Row oldRow) throws SQLException { SearchRow remove(Session session, Row oldRow) throws SQLException {
int l = 0, r = pageData.size(); int l = 0, r = pageData.size();
if (r == 0) {
if (!Constants.ALLOW_EMPTY_BTREE_PAGES && !root) {
Message.throwInternalError("Empty btree page");
}
}
while (l < r) { while (l < r) {
int i = (l + r) >>> 1; int i = (l + r) >>> 1;
SearchRow row = pageData.get(i); SearchRow row = pageData.get(i);
...@@ -148,9 +141,6 @@ public class BtreeLeaf extends BtreePage { ...@@ -148,9 +141,6 @@ public class BtreeLeaf extends BtreePage {
boolean findFirst(BtreeCursor cursor, SearchRow compare, boolean bigger) throws SQLException { boolean findFirst(BtreeCursor cursor, SearchRow compare, boolean bigger) throws SQLException {
int l = 0, r = pageData.size(); int l = 0, r = pageData.size();
if (r == 0 && !Constants.ALLOW_EMPTY_BTREE_PAGES && !root) {
Message.throwInternalError("Empty btree page");
}
while (l < r) { while (l < r) {
int i = (l + r) >>> 1; int i = (l + r) >>> 1;
SearchRow row = pageData.get(i); SearchRow row = pageData.get(i);
...@@ -196,9 +186,6 @@ public class BtreeLeaf extends BtreePage { ...@@ -196,9 +186,6 @@ public class BtreeLeaf extends BtreePage {
void first(BtreeCursor cursor) throws SQLException { void first(BtreeCursor cursor) throws SQLException {
if (pageData.size() == 0) { if (pageData.size() == 0) {
if (!Constants.ALLOW_EMPTY_BTREE_PAGES && !root) {
Message.throwInternalError("Empty btree page");
}
nextUpper(cursor); nextUpper(cursor);
return; return;
} }
...@@ -210,9 +197,6 @@ public class BtreeLeaf extends BtreePage { ...@@ -210,9 +197,6 @@ public class BtreeLeaf extends BtreePage {
void last(BtreeCursor cursor) throws SQLException { void last(BtreeCursor cursor) throws SQLException {
int last = pageData.size() - 1; int last = pageData.size() - 1;
if (last < 0) { if (last < 0) {
if (!Constants.ALLOW_EMPTY_BTREE_PAGES && !root) {
Message.throwInternalError("Empty btree page");
}
previousUpper(cursor); previousUpper(cursor);
return; return;
} }
...@@ -298,9 +282,6 @@ public class BtreeLeaf extends BtreePage { ...@@ -298,9 +282,6 @@ public class BtreeLeaf extends BtreePage {
SearchRow getFirst(Session session) { SearchRow getFirst(Session session) {
if (pageData.size() == 0) { if (pageData.size() == 0) {
if (!Constants.ALLOW_EMPTY_BTREE_PAGES && !root) {
Message.throwInternalError("Empty btree page");
}
return null; return null;
} }
return pageData.get(0); return pageData.get(0);
......
...@@ -7,9 +7,7 @@ ...@@ -7,9 +7,7 @@
package org.h2.index; package org.h2.index;
import java.sql.SQLException; import java.sql.SQLException;
import org.h2.constant.SysProperties; import org.h2.constant.SysProperties;
import org.h2.engine.Constants;
import org.h2.engine.Session; import org.h2.engine.Session;
import org.h2.message.Message; import org.h2.message.Message;
import org.h2.result.Row; import org.h2.result.Row;
...@@ -75,9 +73,6 @@ public class BtreeNode extends BtreePage { ...@@ -75,9 +73,6 @@ public class BtreeNode extends BtreePage {
int add(Row newRow, Session session) throws SQLException { int add(Row newRow, Session session) throws SQLException {
int l = 0, r = pageData.size(); int l = 0, r = pageData.size();
if (!Constants.ALLOW_EMPTY_BTREE_PAGES && !root && pageChildren.size() == 0) {
Message.throwInternalError("Empty btree page");
}
while (l < r) { while (l < r) {
int i = (l + r) >>> 1; int i = (l + r) >>> 1;
SearchRow row = getData(i); SearchRow row = getData(i);
...@@ -125,9 +120,6 @@ public class BtreeNode extends BtreePage { ...@@ -125,9 +120,6 @@ public class BtreeNode extends BtreePage {
SearchRow remove(Session session, Row oldRow) throws SQLException { SearchRow remove(Session session, Row oldRow) throws SQLException {
int l = 0, r = pageData.size(); int l = 0, r = pageData.size();
if (!Constants.ALLOW_EMPTY_BTREE_PAGES && !root && pageChildren.size() == 0) {
Message.throwInternalError("Empty btree page");
}
int comp = 0; int comp = 0;
while (l < r) { while (l < r) {
int i = (l + r) >>> 1; int i = (l + r) >>> 1;
...@@ -221,9 +213,6 @@ public class BtreeNode extends BtreePage { ...@@ -221,9 +213,6 @@ public class BtreeNode extends BtreePage {
boolean findFirst(BtreeCursor cursor, SearchRow compare, boolean bigger) throws SQLException { boolean findFirst(BtreeCursor cursor, SearchRow compare, boolean bigger) throws SQLException {
int l = 0, r = pageData.size(); int l = 0, r = pageData.size();
if (!Constants.ALLOW_EMPTY_BTREE_PAGES && !root && pageChildren.size() == 0) {
Message.throwInternalError("Empty btree page");
}
while (l < r) { while (l < r) {
int i = (l + r) >>> 1; int i = (l + r) >>> 1;
SearchRow row = getData(i); SearchRow row = getData(i);
...@@ -319,9 +308,6 @@ public class BtreeNode extends BtreePage { ...@@ -319,9 +308,6 @@ public class BtreeNode extends BtreePage {
void first(BtreeCursor cursor) throws SQLException { void first(BtreeCursor cursor) throws SQLException {
if (pageChildren.size() == 0) { if (pageChildren.size() == 0) {
if (!Constants.ALLOW_EMPTY_BTREE_PAGES && !root) {
Message.throwInternalError("Empty btree page");
}
nextUpper(cursor); nextUpper(cursor);
return; return;
} }
...@@ -333,9 +319,6 @@ public class BtreeNode extends BtreePage { ...@@ -333,9 +319,6 @@ public class BtreeNode extends BtreePage {
void last(BtreeCursor cursor) throws SQLException { void last(BtreeCursor cursor) throws SQLException {
int last = pageChildren.size() - 1; int last = pageChildren.size() - 1;
if (last < 0) { if (last < 0) {
if (!Constants.ALLOW_EMPTY_BTREE_PAGES && !root) {
Message.throwInternalError("Empty btree page");
}
previousUpper(cursor); previousUpper(cursor);
return; return;
} }
......
...@@ -100,7 +100,7 @@ public class HashIndex extends BaseIndex { ...@@ -100,7 +100,7 @@ public class HashIndex extends BaseIndex {
public Cursor find(Session session, SearchRow first, SearchRow last) throws SQLException { public Cursor find(Session session, SearchRow first, SearchRow last) throws SQLException {
if (first == null || last == null) { if (first == null || last == null) {
// TODO hash index: should additionally check if values are the same // TODO hash index: should additionally check if values are the same
Message.throwInternalError(); throw Message.throwInternalError();
} }
Row result; Row result;
if (intMap != null) { if (intMap != null) {
......
...@@ -139,7 +139,7 @@ public class TreeIndex extends BaseIndex { ...@@ -139,7 +139,7 @@ public class TreeIndex extends BaseIndex {
public void remove(Session session, Row row) throws SQLException { public void remove(Session session, Row row) throws SQLException {
TreeNode x = findFirstNode(row, true); TreeNode x = findFirstNode(row, true);
if (x == null) { if (x == null) {
Message.throwInternalError("not found!"); throw Message.throwInternalError("not found!");
} }
TreeNode n; TreeNode n;
if (x.left == null) { if (x.left == null) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论