SITransactorInMemTest.java 文件源码

java
阅读 33 收藏 0 点赞 0 评论 0

项目:spliceengine 作者:
@Test//(expected = CannotCommitException.class)
public void writeWriteOverlap() throws IOException {
    Txn t1 = control.beginTransaction();
    Assert.assertEquals("joe012 absent", testUtility.read(t1, "joe012"));
    t1 = t1.elevateToWritable(DESTINATION_TABLE);
    testUtility.insertAge(t1, "joe012", 20);
    Assert.assertEquals("joe012 age=20 job=null", testUtility.read(t1, "joe012"));

    Txn t2 = control.beginTransaction();
    Assert.assertEquals("joe012 age=20 job=null", testUtility.read(t1, "joe012"));
    Assert.assertEquals("joe012 absent", testUtility.read(t2, "joe012"));
    t2 = t2.elevateToWritable(DESTINATION_TABLE);
    try {
        testUtility.insertAge(t2, "joe012", 30);
        Assert.fail("was able to insert age");
    } catch (IOException e) {
        testUtility.assertWriteConflict(e);
    } finally {
        t2.rollback();
    }
    Assert.assertEquals("joe012 age=20 job=null", testUtility.read(t1, "joe012"));
    t1.commit();
    error.expect(IsInstanceOf.instanceOf(CannotCommitException.class));
    t2.commit(); //should not work, probably need to change assertion
    Assert.fail("Was able to commit a rolled back transaction");
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号