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

Reverted schema meta lock fix, not needed

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