提交 341a5915 authored 作者: Owner's avatar Owner

Reverted schema meta lock fix, not needed

上级 d4fb4c1c
...@@ -5206,7 +5206,7 @@ public class Parser { ...@@ -5206,7 +5206,7 @@ public class Parser {
if (readIf("(")) { if (readIf("(")) {
cols = parseColumnList(); cols = parseColumnList();
for (String c : cols) { for (String c : cols) {
// we don't really know the type of the column, so UNKNOWN will // we don't really know the type of the column, so STRING will
// have to do // have to do
columns.add(new Column(c, Value.STRING)); columns.add(new Column(c, Value.STRING));
} }
......
...@@ -639,44 +639,26 @@ public class Schema extends DbObjectBase { ...@@ -639,44 +639,26 @@ public class Schema extends DbObjectBase {
* @return the created {@link Table} object * @return the created {@link Table} object
*/ */
public Table createTable(CreateTableData data) { public Table createTable(CreateTableData data) {
Database acquiredMetaLockDatabase = null; synchronized (database) {
try{ if (!data.temporary || data.globalTemporary) {
synchronized (database) { database.lockMeta(data.session);
if (!data.temporary || data.globalTemporary) { }
database.lockMeta(data.session); data.schema = this;
if (data.tableEngine == null) {
// remember to unlock the meta lock before we leave this method DbSettings s = database.getSettings();
acquiredMetaLockDatabase = database; if (s.defaultTableEngine != null) {
} data.tableEngine = s.defaultTableEngine;
data.schema = this; } else if (s.mvStore) {
if (data.tableEngine == null) { data.tableEngine = MVTableEngine.class.getName();
DbSettings s = database.getSettings();
if (s.defaultTableEngine != null) {
data.tableEngine = s.defaultTableEngine;
} else if (s.mvStore) {
data.tableEngine = MVTableEngine.class.getName();
}
}
if (data.tableEngine != null) {
if (data.tableEngineParams == null) {
data.tableEngineParams = this.tableEngineParams;
}
// the createTable method unlocks the meta - so turn off flag now
acquiredMetaLockDatabase=null;
return database.getTableEngine(data.tableEngine).createTable(data);
} }
// the RegularTable constructor unlocks the meta - so turn off flag now
acquiredMetaLockDatabase=null;
return new RegularTable(data);
} }
} if (data.tableEngine != null) {
finally{ if (data.tableEngineParams == null) {
if(acquiredMetaLockDatabase!=null && data.session!=null){ data.tableEngineParams = this.tableEngineParams;
if(acquiredMetaLockDatabase.isSysTableLockedBy(data.session)){
acquiredMetaLockDatabase.unlockMeta(data.session);
} }
return database.getTableEngine(data.tableEngine).createTable(data);
} }
return new RegularTable(data);
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论