@Test public void bptree_txn_02() { BPlusTree bpt = createBPTree() ; int outerRootIdx1 = bpt.getRootId() ; Transactional thing = transactional(bpt) ; Txn.executeWrite(thing, () -> { int rootIdx1 = bpt.getRootId() ; assertEquals("Inside txn (1)", outerRootIdx1, rootIdx1); IndexTestLib.add(bpt, 1) ; int rootIdx2 = bpt.getRootId() ; assertNotEquals("Inside txn (2)", rootIdx1, rootIdx2); IndexTestLib.add(bpt, 2, 3, 4) ; int rootIdx3 = bpt.getRootId() ; assertEquals("Inside txn (3)", rootIdx2, rootIdx3); } ) ; int outerRootIdx2 = bpt.getRootId() ; assertNotEquals("After txn", outerRootIdx1, outerRootIdx2); }
@Test public void bptree_txn_02() { BPlusTree bpt = createBPTree() ; int outerRootIdx1 = bpt.getRootId() ; Transactional thing = transactional(bpt) ; Txn.executeWrite(thing, () -> { int rootIdx1 = bpt.getRootId() ; assertEquals("Inside txn (1)", outerRootIdx1, rootIdx1); IndexTestLib.add(bpt, 1) ; int rootIdx2 = bpt.getRootId() ; assertNotEquals("Inside txn (2)", rootIdx1, rootIdx2); IndexTestLib.add(bpt, 2, 3, 4) ; int rootIdx3 = bpt.getRootId() ; assertEquals("Inside txn (3)", rootIdx2, rootIdx3); } ) ; int outerRootIdx2 = bpt.getRootId() ; assertNotEquals("After txn", outerRootIdx1, outerRootIdx2); }
@Test public void bptree_txn_03() { BPlusTree bpt = createBPTree() ; int outerRootIdx1 = bpt.getRootId() ; Transactional thing = transactional(bpt) ; thing.begin(ReadWrite.WRITE); IndexTestLib.add(bpt, 1, 2, 3, 4) ; thing.abort() ; thing.end() ; int outerRootIdx2 = bpt.getRootId() ; assertEquals("After txn", outerRootIdx1, outerRootIdx2); }
@Test public void bptree_txn_05() { BPlusTree bpt = createBPTree() ; int outerRootIdx1 = bpt.getRootId() ; Transactional thing = transactional(bpt) ; Txn.executeWrite(thing, () -> { IndexTestLib.add(bpt, 1, 2, 3) ; } ); int outerRootIdx2 = bpt.getRootId() ; assertNotEquals("After txn(1)", outerRootIdx1, outerRootIdx2); Txn.executeWrite(thing, () -> { IndexTestLib.add(bpt, 1, 2) ; } ); int outerRootIdx3 = bpt.getRootId() ; assertNotEquals("After txn (2)", outerRootIdx1, outerRootIdx3); assertEquals("After txn (3)", outerRootIdx2, outerRootIdx3); }
@Test public void bptree_txn_06() { BPlusTree bpt = createBPTree() ; int outerRootIdx1 = bpt.getRootId() ; Transactional thing = transactional(bpt) ; Txn.executeWrite(thing, () -> { IndexTestLib.add(bpt, 1, 2, 3) ; } ); int outerRootIdx2 = bpt.getRootId() ; assertNotEquals("After txn(1)", outerRootIdx1, outerRootIdx2); Txn.executeWrite(thing, () -> { IndexTestLib.delete(bpt, 5, 6) ; } ); int outerRootIdx3 = bpt.getRootId() ; assertNotEquals("After txn (2)", outerRootIdx1, outerRootIdx3); assertEquals("After txn (3)", outerRootIdx2, outerRootIdx3); }
@Test public void bptree_txn_05() { BPlusTree bpt = createBPTree() ; int outerRootIdx1 = bpt.getRootId() ; Transactional thing = transactional(bpt) ; Txn.executeWrite(thing, () -> { IndexTestLib.add(bpt, 1, 2, 3) ; } ); int outerRootIdx2 = bpt.getRootId() ; assertNotEquals("After txn(1)", outerRootIdx1, outerRootIdx2); Txn.executeWrite(thing, () -> { IndexTestLib.add(bpt, 1, 2) ; } ); int outerRootIdx3 = bpt.getRootId() ; assertNotEquals("After txn (2)", outerRootIdx1, outerRootIdx3); assertEquals("After txn (3)", outerRootIdx2, outerRootIdx3); }
@Test public void bptree_txn_04() { BPlusTree bpt = createBPTree() ; int outerRootIdx1 = bpt.getRootId() ; Transactional thing = transactional(bpt) ; Txn.executeWrite(thing, () -> { IndexTestLib.add(bpt, 1, 2, 3, 4) ; } ); int outerRootIdx2 = bpt.getRootId() ; assertNotEquals("After txn(1)", outerRootIdx1, outerRootIdx2); Txn.executeWrite(thing, () -> { IndexTestLib.add(bpt, 5, 6) ; } ); int outerRootIdx3 = bpt.getRootId() ; assertNotEquals("After txn (2)", outerRootIdx1, outerRootIdx3); assertNotEquals("After txn (3)", outerRootIdx2, outerRootIdx3); }
@Test public void bptree_txn_01() { BPlusTree bpt = createBPTree() ; assertNotNull(bpt.getComponentId()) ; int outerRootIdx1 = bpt.getRootId() ; Transactional thing = transactional(bpt) ; Txn.executeWrite(thing, () -> { IndexTestLib.add(bpt, 1, 2, 3, 4) ; } ); int outerRootIdx2 = bpt.getRootId() ; assertNotEquals("After txn", outerRootIdx1, outerRootIdx2); }
@Test public void bptree_txn_01() { BPlusTree bpt = createBPTree() ; assertNotNull(bpt.getComponentId()) ; int outerRootIdx1 = bpt.getRootId() ; Transactional thing = transactional(bpt) ; Txn.executeWrite(thing, () -> { IndexTestLib.add(bpt, 1, 2, 3, 4) ; } ); int outerRootIdx2 = bpt.getRootId() ; assertNotEquals("After txn", outerRootIdx1, outerRootIdx2); }
@Test public void bptree_txn_03() { BPlusTree bpt = createBPTree() ; int outerRootIdx1 = bpt.getRootId() ; Transactional thing = transactional(bpt) ; thing.begin(ReadWrite.WRITE); IndexTestLib.add(bpt, 1, 2, 3, 4) ; thing.abort() ; thing.end() ; int outerRootIdx2 = bpt.getRootId() ; assertEquals("After txn", outerRootIdx1, outerRootIdx2); }
@Test public void bptree_txn_04() { BPlusTree bpt = createBPTree() ; int outerRootIdx1 = bpt.getRootId() ; Transactional thing = transactional(bpt) ; Txn.executeWrite(thing, () -> { IndexTestLib.add(bpt, 1, 2, 3, 4) ; } ); int outerRootIdx2 = bpt.getRootId() ; assertNotEquals("After txn(1)", outerRootIdx1, outerRootIdx2); Txn.executeWrite(thing, () -> { IndexTestLib.add(bpt, 5, 6) ; } ); int outerRootIdx3 = bpt.getRootId() ; assertNotEquals("After txn (2)", outerRootIdx1, outerRootIdx3); assertNotEquals("After txn (3)", outerRootIdx2, outerRootIdx3); }
@Test public void bptree_txn_06() { BPlusTree bpt = createBPTree() ; int outerRootIdx1 = bpt.getRootId() ; Transactional thing = transactional(bpt) ; Txn.executeWrite(thing, () -> { IndexTestLib.add(bpt, 1, 2, 3) ; } ); int outerRootIdx2 = bpt.getRootId() ; assertNotEquals("After txn(1)", outerRootIdx1, outerRootIdx2); Txn.executeWrite(thing, () -> { IndexTestLib.delete(bpt, 5, 6) ; } ); int outerRootIdx3 = bpt.getRootId() ; assertNotEquals("After txn (2)", outerRootIdx1, outerRootIdx3); assertEquals("After txn (3)", outerRootIdx2, outerRootIdx3); }
if ( BPT.CheckingNode ) { nodeManager.startRead(); BPTreeNode root = nodeManager.getRead(bpt.getRootId(), BPlusTreeParams.RootParent) ; root.checkNodeDeep() ; nodeManager.release(root) ;
if ( BPT.CheckingNode ) { nodeManager.startRead(); BPTreeNode root = nodeManager.getRead(bpt.getRootId(), BPlusTreeParams.RootParent) ; root.checkNodeDeep() ; nodeManager.release(root) ;