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