提交 2417b1c3 authored 作者: Thomas Mueller's avatar Thomas Mueller

When upgrading from an older 1.3.x version to version 1.3.157, when using BLOB…

When upgrading from an older 1.3.x version to version 1.3.157, when using BLOB or CLOB data, the database could only be opened once.
上级 afeacc24
......@@ -1037,6 +1037,18 @@ public class Database implements DataHandler {
}
closing = true;
}
// remove all session variables
if (persistent) {
boolean lobStorageIsUsed = infoSchema.findTableOrView(systemSession, LobStorage.LOB_DATA_TABLE) != null;
if (lobStorageIsUsed) {
try {
getLobStorage();
lobStorage.removeAllForTable(LobStorage.TABLE_ID_SESSION_VARIABLE);
} catch (DbException e) {
trace.error(e, "close");
}
}
}
try {
if (systemSession != null) {
if (powerOffCount != -1) {
......@@ -1068,18 +1080,6 @@ public class Database implements DataHandler {
} catch (DbException e) {
trace.error(e, "close");
}
// remove all session variables
if (persistent) {
boolean lobStorageIsUsed = infoSchema.findTableOrView(systemSession, LobStorage.LOB_DATA_TABLE) != null;
if (lobStorageIsUsed) {
try {
getLobStorage();
lobStorage.removeAllForTable(LobStorage.TABLE_ID_SESSION_VARIABLE);
} catch (DbException e) {
trace.error(e, "close");
}
}
}
tempFileDeleter.deleteAll();
try {
closeOpenFilesAndUnlock(true);
......
......@@ -25,6 +25,7 @@ public class TreeIndex extends BaseIndex {
private TreeNode root;
private RegularTable tableData;
private long rowCount;
private boolean closed;
public TreeIndex(RegularTable table, int id, String indexName, IndexColumn[] columns, IndexType indexType) {
initBaseIndex(table, id, indexName, columns, indexType);
......@@ -33,9 +34,13 @@ public class TreeIndex extends BaseIndex {
public void close(Session session) {
root = null;
closed = true;
}
public void add(Session session, Row row) {
if (closed) {
throw DbException.throwInternalError();
}
TreeNode i = new TreeNode(row);
TreeNode n = root, x = n;
boolean isLeft = true;
......@@ -136,6 +141,9 @@ public class TreeIndex extends BaseIndex {
}
public void remove(Session session, Row row) {
if (closed) {
throw DbException.throwInternalError();
}
TreeNode x = findFirstNode(row, true);
if (x == null) {
throw DbException.throwInternalError("not found!");
......@@ -326,6 +334,9 @@ public class TreeIndex extends BaseIndex {
}
public Cursor findFirstOrLast(Session session, boolean first) {
if (closed) {
throw DbException.throwInternalError();
}
if (first) {
// TODO optimization: this loops through NULL
Cursor cursor = find(session, null, null);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论