提交 20be82db authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Replace trivial usages of SysProperties.CHECK2 with assertions

上级 9ce14802
...@@ -722,12 +722,7 @@ public class Session extends SessionWithState implements TransactionStore.Rollba ...@@ -722,12 +722,7 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
} }
private void removeTemporaryLobs(boolean onTimeout) { private void removeTemporaryLobs(boolean onTimeout) {
if (SysProperties.CHECK2) { assert this != getDatabase().getLobSession() || Thread.holdsLock(this) || Thread.holdsLock(getDatabase());
if (this == getDatabase().getLobSession()
&& !Thread.holdsLock(this) && !Thread.holdsLock(getDatabase())) {
throw DbException.throwInternalError();
}
}
if (temporaryLobs != null) { if (temporaryLobs != null) {
for (Value v : temporaryLobs) { for (Value v : temporaryLobs) {
if (!v.isLinkedToTable()) { if (!v.isLinkedToTable()) {
......
...@@ -491,11 +491,7 @@ public class PageDataLeaf extends PageData { ...@@ -491,11 +491,7 @@ public class PageDataLeaf extends PageData {
} }
data.writeByte((byte) type); data.writeByte((byte) type);
data.writeShortInt(0); data.writeShortInt(0);
if (SysProperties.CHECK2) { assert data.length() == START_PARENT;
if (data.length() != START_PARENT) {
DbException.throwInternalError();
}
}
data.writeInt(parentPageId); data.writeInt(parentPageId);
data.writeVarInt(index.getId()); data.writeVarInt(index.getId());
data.writeVarInt(columnCount); data.writeVarInt(columnCount);
......
...@@ -351,11 +351,7 @@ public class PageDataNode extends PageData { ...@@ -351,11 +351,7 @@ public class PageDataNode extends PageData {
data.reset(); data.reset();
data.writeByte((byte) Page.TYPE_DATA_NODE); data.writeByte((byte) Page.TYPE_DATA_NODE);
data.writeShortInt(0); data.writeShortInt(0);
if (SysProperties.CHECK2) { assert data.length() == START_PARENT;
if (data.length() != START_PARENT) {
DbException.throwInternalError();
}
}
data.writeInt(parentPageId); data.writeInt(parentPageId);
data.writeVarInt(index.getId()); data.writeVarInt(index.getId());
data.writeInt(rowCountStored); data.writeInt(rowCountStored);
......
...@@ -705,13 +705,8 @@ public class Data { ...@@ -705,13 +705,8 @@ public class Data {
} }
DbException.throwInternalError("type=" + v.getType()); DbException.throwInternalError("type=" + v.getType());
} }
if (SysProperties.CHECK2) { assert pos - start == getValueLen(v, handler)
if (pos - start != getValueLen(v, handler)) { : "value size error: got " + (pos - start) + " expected " + getValueLen(v, handler);
throw DbException.throwInternalError(
"value size error: got " + (pos - start) +
" expected " + getValueLen(v, handler));
}
}
} }
/** /**
......
...@@ -249,11 +249,7 @@ public class LobStorageBackend implements LobStorageInterface { ...@@ -249,11 +249,7 @@ public class LobStorageBackend implements LobStorageInterface {
* @return the prepared statement * @return the prepared statement
*/ */
PreparedStatement prepare(String sql) throws SQLException { PreparedStatement prepare(String sql) throws SQLException {
if (SysProperties.CHECK2) { assert Thread.holdsLock(database);
if (!Thread.holdsLock(database)) {
throw DbException.throwInternalError();
}
}
PreparedStatement prep = prepared.remove(sql); PreparedStatement prep = prepared.remove(sql);
if (prep == null) { if (prep == null) {
prep = conn.prepareStatement(sql); prep = conn.prepareStatement(sql);
...@@ -268,11 +264,7 @@ public class LobStorageBackend implements LobStorageInterface { ...@@ -268,11 +264,7 @@ public class LobStorageBackend implements LobStorageInterface {
* @param prep the prepared statement * @param prep the prepared statement
*/ */
void reuse(String sql, PreparedStatement prep) { void reuse(String sql, PreparedStatement prep) {
if (SysProperties.CHECK2) { assert Thread.holdsLock(database);
if (!Thread.holdsLock(database)) {
throw DbException.throwInternalError();
}
}
prepared.put(sql, prep); prepared.put(sql, prep);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论