提交 62974d5f authored 作者: Thomas Mueller's avatar Thomas Mueller

Server-less multi-connection mode: two processes writing, corrupt after closing.

上级 60dbc58e
...@@ -34,12 +34,27 @@ public class TestFileLockSerialized extends TestBase { ...@@ -34,12 +34,27 @@ public class TestFileLockSerialized extends TestBase {
public void test() throws Exception { public void test() throws Exception {
Class.forName("org.h2.Driver"); Class.forName("org.h2.Driver");
testTwoReaders();
testTwoWriters(); testTwoWriters();
testPendingWrite(); testPendingWrite();
testKillWriter(); testKillWriter();
testConcurrentReadWrite(); testConcurrentReadWrite();
} }
private void testTwoReaders() throws Exception {
deleteDb("fileLockSerialized");
String url = "jdbc:h2:" + baseDir + "/fileLockSerialized;FILE_LOCK=SERIALIZED;OPEN_NEW=TRUE";
Connection conn1 = DriverManager.getConnection(url);
conn1.createStatement().execute("create table test(id int)");
Connection conn2 = DriverManager.getConnection(url);
Statement stat2 = conn2.createStatement();
stat2.execute("drop table test");
stat2.execute("create table test(id identity) as select 1");
conn2.close();
conn1.close();
DriverManager.getConnection(url).close();
}
private void testTwoWriters() throws Exception { private void testTwoWriters() throws Exception {
deleteDb("fileLockSerialized"); deleteDb("fileLockSerialized");
String url = "jdbc:h2:" + baseDir + "/fileLockSerialized"; String url = "jdbc:h2:" + baseDir + "/fileLockSerialized";
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论