/** Reset an existing B+Tree with different storage units. * For each, null means "use same as original" */ public static BPlusTree rebuild(BPlusTree bpt, BufferChannel chan, BlockMgr blkMgrNodes, BlockMgr blkMgrLeaves) { if ( chan == null ) chan = bpt.getStateManager().getBufferChannel() ; if ( blkMgrNodes == null ) blkMgrNodes = bpt.getNodeManager().getBlockMgr() ; if ( blkMgrLeaves == null ) blkMgrLeaves = bpt.getNodeManager().getBlockMgr() ; BPlusTree bpt2 = attach(bpt.getComponentId(), bpt.getParams(), true, chan, blkMgrNodes, blkMgrLeaves) ; return bpt2 ; }
/** Reset an existing B+Tree with different storage units. * For each, null means "use same as original" */ public static BPlusTree rebuild(BPlusTree bpt, BufferChannel chan, BlockMgr blkMgrNodes, BlockMgr blkMgrLeaves) { if ( chan == null ) chan = bpt.getStateManager().getBufferChannel() ; if ( blkMgrNodes == null ) blkMgrNodes = bpt.getNodeManager().getBlockMgr() ; if ( blkMgrLeaves == null ) blkMgrLeaves = bpt.getNodeManager().getBlockMgr() ; BPlusTree bpt2 = attach(bpt.getComponentId(), bpt.getParams(), true, chan, blkMgrNodes, blkMgrLeaves) ; return bpt2 ; }
@Test public void bptree_txn_10() { BPlusTree bpt1 = createBPTree() ; BPlusTree bpt2 = createBPTree() ; assertNotEquals(bpt1.getComponentId(), bpt2.getComponentId()) ; Transactional thing = transactional(bpt1, bpt2) ; Txn.executeWrite(thing, () -> { IndexTestLib.add(bpt1, 1, 2, 3) ; IndexTestLib.add(bpt2, 4, 5) ; } ); Txn.executeRead(thing, ()->{ IndexTestLib.testIndexContents(bpt2, 4, 5); IndexTestLib.testIndexContents(bpt1, 1, 2, 3); } ); }
@Test public void bptree_txn_10() { BPlusTree bpt1 = createBPTree() ; BPlusTree bpt2 = createBPTree() ; assertNotEquals(bpt1.getComponentId(), bpt2.getComponentId()) ; Transactional thing = transactional(bpt1, bpt2) ; Txn.executeWrite(thing, () -> { IndexTestLib.add(bpt1, 1, 2, 3) ; IndexTestLib.add(bpt2, 4, 5) ; } ); Txn.executeRead(thing, ()->{ IndexTestLib.testIndexContents(bpt2, 4, 5); IndexTestLib.testIndexContents(bpt1, 1, 2, 3); } ); }
@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_11() { BPlusTree bpt1 = createBPTree() ; BPlusTree bpt2 = createBPTree() ; assertNotEquals(bpt1.getComponentId(), bpt2.getComponentId()) ;
@Test public void bptree_txn_11() { BPlusTree bpt1 = createBPTree() ; BPlusTree bpt2 = createBPTree() ; assertNotEquals(bpt1.getComponentId(), bpt2.getComponentId()) ;