提交 a23e5087 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Also test that in-doubt transaction presents after forced shutdown

上级 c0ab75ec
......@@ -152,6 +152,20 @@ public class TestTwoPhaseCommit extends TestBase {
assertTrue(rs.next());
assertEquals(1, rs.getInt(1));
assertFalse(rs.next());
conn.setAutoCommit(false);
stat.execute("INSERT INTO TEST VALUES (3)");
stat.execute("PREPARE COMMIT \"#3\"");
stat.execute("SHUTDOWN IMMEDIATELY");
conn = getConnection("twoPhaseCommit");
stat = conn.createStatement();
rs = stat.executeQuery("SELECT TRANSACTION, STATE FROM INFORMATION_SCHEMA.IN_DOUBT");
assertTrue(rs.next());
assertEquals("#3", rs.getString("TRANSACTION"));
assertEquals("IN_DOUBT", rs.getString("STATE"));
rs = stat.executeQuery("SELECT ID FROM TEST");
assertTrue(rs.next());
assertEquals(1, rs.getInt(1));
assertFalse(rs.next());
conn.close();
deleteDb("twoPhaseCommit");
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论