提交 d050026e 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).
上级 91c10438
......@@ -54,6 +54,7 @@ public class TestMultiThread extends TestBase implements Runnable {
@Override
public void test() throws Exception {
testConcurrentSchemaChange();
testConcurrentLobAdd();
testConcurrentView();
testConcurrentAlter();
......@@ -61,6 +62,40 @@ public class TestMultiThread extends TestBase implements Runnable {
testConcurrentInsertUpdateSelect();
testLockModeWithMultiThreaded();
}
private void testConcurrentSchemaChange() throws Exception {
String db = "testConcurrentSchemaChange";
deleteDb(db);
final String url = getURL(db + ";MULTI_THREADED=1", true);
Connection conn = getConnection(url);
Task[] tasks = new Task[2];
for (int i = 0; i < tasks.length; i++) {
final int x = i;
Task t = new Task() {
@Override
public void call() throws Exception {
Connection c2 = getConnection(url);
Statement stat = c2.createStatement();
try {
for (int i = 0; !stop; i++) {
stat.execute("create table test" + x + "_" + i);
c2.getMetaData().getTables(null, null, null, null);
stat.execute("drop table test" + x + "_" + i);
}
} finally {
c2.close();
}
}
};
tasks[i] = t;
t.execute();
}
Thread.sleep(1000);
for (Task t : tasks) {
t.get();
}
conn.close();
}
private void testConcurrentLobAdd() throws Exception {
String db = "concurrentLobAdd";
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论