提交 51813804 authored 作者: Thomas Mueller's avatar Thomas Mueller

Multi-Version Concurrency (MVCC) may no longer be used when using MULTI_THREADED

上级 30327315
...@@ -197,7 +197,6 @@ public class Database implements DataHandler { ...@@ -197,7 +197,6 @@ public class Database implements DataHandler {
this.recovery = true; this.recovery = true;
} }
this.multiVersion = ci.removeProperty("MVCC", false); this.multiVersion = ci.removeProperty("MVCC", false);
checkMultiThreadedAllowed();
boolean closeAtVmShutdown = ci.removeProperty("DB_CLOSE_ON_EXIT", true); boolean closeAtVmShutdown = ci.removeProperty("DB_CLOSE_ON_EXIT", true);
int traceLevelFile = ci.getIntProperty(SetTypes.TRACE_LEVEL_FILE, TraceSystem.DEFAULT_TRACE_LEVEL_FILE); int traceLevelFile = ci.getIntProperty(SetTypes.TRACE_LEVEL_FILE, TraceSystem.DEFAULT_TRACE_LEVEL_FILE);
int traceLevelSystemOut = ci.getIntProperty(SetTypes.TRACE_LEVEL_SYSTEM_OUT, int traceLevelSystemOut = ci.getIntProperty(SetTypes.TRACE_LEVEL_SYSTEM_OUT,
...@@ -789,8 +788,11 @@ public class Database implements DataHandler { ...@@ -789,8 +788,11 @@ public class Database implements DataHandler {
* @param obj the object to add * @param obj the object to add
*/ */
public synchronized void addSchemaObject(Session session, SchemaObject obj) throws SQLException { public synchronized void addSchemaObject(Session session, SchemaObject obj) throws SQLException {
obj.getSchema().add(obj);
int id = obj.getId(); int id = obj.getId();
if (id > 0 && !starting) {
checkWritingAllowed();
}
obj.getSchema().add(obj);
if (id > 0 && !starting) { if (id > 0 && !starting) {
addMeta(session, obj); addMeta(session, obj);
} }
...@@ -803,6 +805,10 @@ public class Database implements DataHandler { ...@@ -803,6 +805,10 @@ public class Database implements DataHandler {
* @param obj the object to add * @param obj the object to add
*/ */
public synchronized void addDatabaseObject(Session session, DbObject obj) throws SQLException { public synchronized void addDatabaseObject(Session session, DbObject obj) throws SQLException {
int id = obj.getId();
if (id > 0 && !starting) {
checkWritingAllowed();
}
HashMap map = getMap(obj.getType()); HashMap map = getMap(obj.getType());
if (obj.getType() == DbObject.USER) { if (obj.getType() == DbObject.USER) {
User user = (User) obj; User user = (User) obj;
...@@ -814,7 +820,6 @@ public class Database implements DataHandler { ...@@ -814,7 +820,6 @@ public class Database implements DataHandler {
if (SysProperties.CHECK && map.get(name) != null) { if (SysProperties.CHECK && map.get(name) != null) {
throw Message.getInternalError("object already exists"); throw Message.getInternalError("object already exists");
} }
int id = obj.getId();
if (id > 0 && !starting) { if (id > 0 && !starting) {
addMeta(session, obj); addMeta(session, obj);
} }
...@@ -1309,6 +1314,7 @@ public class Database implements DataHandler { ...@@ -1309,6 +1314,7 @@ public class Database implements DataHandler {
* @param newName the new name * @param newName the new name
*/ */
public synchronized void renameSchemaObject(Session session, SchemaObject obj, String newName) throws SQLException { public synchronized void renameSchemaObject(Session session, SchemaObject obj, String newName) throws SQLException {
checkWritingAllowed();
obj.getSchema().rename(obj, newName); obj.getSchema().rename(obj, newName);
updateWithChildren(session, obj); updateWithChildren(session, obj);
} }
...@@ -1337,6 +1343,7 @@ public class Database implements DataHandler { ...@@ -1337,6 +1343,7 @@ public class Database implements DataHandler {
* @param newName the new name * @param newName the new name
*/ */
public synchronized void renameDatabaseObject(Session session, DbObject obj, String newName) throws SQLException { public synchronized void renameDatabaseObject(Session session, DbObject obj, String newName) throws SQLException {
checkWritingAllowed();
int type = obj.getType(); int type = obj.getType();
HashMap map = getMap(type); HashMap map = getMap(type);
if (SysProperties.CHECK) { if (SysProperties.CHECK) {
...@@ -1447,6 +1454,7 @@ public class Database implements DataHandler { ...@@ -1447,6 +1454,7 @@ public class Database implements DataHandler {
* @param obj the object to remove * @param obj the object to remove
*/ */
public synchronized void removeDatabaseObject(Session session, DbObject obj) throws SQLException { public synchronized void removeDatabaseObject(Session session, DbObject obj) throws SQLException {
checkWritingAllowed();
String objName = obj.getName(); String objName = obj.getName();
int type = obj.getType(); int type = obj.getType();
HashMap map = getMap(type); HashMap map = getMap(type);
...@@ -1516,6 +1524,7 @@ public class Database implements DataHandler { ...@@ -1516,6 +1524,7 @@ public class Database implements DataHandler {
return; return;
} }
} }
checkWritingAllowed();
Comment comment = findComment(obj); Comment comment = findComment(obj);
if (comment != null) { if (comment != null) {
removeDatabaseObject(session, comment); removeDatabaseObject(session, comment);
...@@ -1952,23 +1961,17 @@ public class Database implements DataHandler { ...@@ -1952,23 +1961,17 @@ public class Database implements DataHandler {
return mode; return mode;
} }
public boolean getMultiThreaded() { public boolean isMultiThreaded() {
return multiThreaded; return multiThreaded;
} }
public void setMultiThreaded(boolean multiThreaded) throws SQLException { public void setMultiThreaded(boolean multiThreaded) throws SQLException {
this.multiThreaded = multiThreaded;
checkMultiThreadedAllowed();
}
private void checkMultiThreadedAllowed() throws SQLException {
if (multiThreaded && multiVersion) { if (multiThreaded && multiVersion) {
multiVersion = false;
throw Message.getSQLException(ErrorCode.CANNOT_CHANGE_SETTING_WHEN_OPEN_1, "MVCC & MULTI_THREADED"); throw Message.getSQLException(ErrorCode.CANNOT_CHANGE_SETTING_WHEN_OPEN_1, "MVCC & MULTI_THREADED");
} }
this.multiThreaded = multiThreaded;
} }
public void setMaxOperationMemory(int maxOperationMemory) { public void setMaxOperationMemory(int maxOperationMemory) {
this.maxOperationMemory = maxOperationMemory; this.maxOperationMemory = maxOperationMemory;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论