提交 152237c3 authored 作者: Thomas Mueller's avatar Thomas Mueller

In the multi-threaded mode, database metadata operations did sometimes not work…

In the multi-threaded mode, database metadata operations did sometimes not work if the schema was changed at the same time (for example, if tables were dropped).
上级 2d67551e
......@@ -50,7 +50,8 @@ public class MVTable extends TableBase {
private final ArrayList<Index> indexes = New.arrayList();
private long lastModificationId;
private volatile Session lockExclusiveSession;
/** using a ConcurrentHashMap as a Set */
// using a ConcurrentHashMap as a set
private final ConcurrentHashMap<Session, Session> lockSharedSessions = new ConcurrentHashMap<Session, Session>();
/**
......@@ -750,7 +751,6 @@ public class MVTable extends TableBase {
}
primaryIndex.remove(session);
database.removeMeta(session, getId());
primaryIndex = null;
close(session);
invalidate();
}
......
......@@ -8,6 +8,7 @@ package org.h2.table;
import java.util.ArrayList;
import java.util.List;
import org.h2.command.ddl.CreateTableData;
import org.h2.engine.Database;
import org.h2.engine.DbSettings;
import org.h2.mvstore.db.MVTableEngine;
import org.h2.util.StatementBuilder;
......@@ -51,6 +52,11 @@ public abstract class TableBase extends Table {
@Override
public String getCreateSQL() {
Database db = getDatabase();
if (db == null) {
// closed
return null;
}
StatementBuilder buff = new StatementBuilder("CREATE ");
if (isTemporary()) {
if (isGlobalTemporary()) {
......@@ -79,7 +85,7 @@ public abstract class TableBase extends Table {
}
buff.append("\n)");
if (tableEngine != null) {
DbSettings s = getDatabase().getSettings();
DbSettings s = db.getSettings();
String d = s.defaultTableEngine;
if (d == null && s.mvStore) {
d = MVTableEngine.class.getName();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论