/** Split this block - return the split record (key only needed) */ @Override final BPTreePage split() { // Median record : will go in parent. int ix = params.SplitIndex ; // New block. BPTreeNode z = create(this.parent, isLeaf) ; // Leave the low end untouched and copy, and clear the high end. // z becomes the new upper node, not the lower node. // 'this' is the lower block. int maxRec = maxRecords() ; // Copy from top of y into z. records.copy(ix + 1, z.records, 0, maxRec - (ix + 1)) ; records.clear(ix, maxRec - ix) ; // Clear copied and median slot records.setSize(ix) ; // Reset size ptrs.copy(ix + 1, z.ptrs, 0, params.MaxPtr - (ix + 1)) ; ptrs.clear(ix + 1, params.MaxPtr - (ix + 1)) ; ptrs.setSize(ix + 1) ; // Set sizes of subnodes setCount(ix) ; // Median is ix internalCheckNode() ; // y finished z.isLeaf = isLeaf ; z.setCount(maxRec - (ix + 1)) ; // Number copied into z // Caller puts the blocks in split(int, BTreePage) z.internalCheckNode() ; return z ; }
/** Split this block - return the split record (key only needed) */ @Override final BPTreePage split() { // Median record : will go in parent. int ix = params.SplitIndex ; // New block. BPTreeNode z = create(this.parent, isLeaf) ; // Leave the low end untouched and copy, and clear the high end. // z becomes the new upper node, not the lower node. // 'this' is the lower block. int maxRec = maxRecords() ; // Copy from top of y into z. records.copy(ix + 1, z.records, 0, maxRec - (ix + 1)) ; records.clear(ix, maxRec - ix) ; // Clear copied and median slot records.setSize(ix) ; // Reset size ptrs.copy(ix + 1, z.ptrs, 0, params.MaxPtr - (ix + 1)) ; ptrs.clear(ix + 1, params.MaxPtr - (ix + 1)) ; ptrs.setSize(ix + 1) ; // Set sizes of subnodes setCount(ix) ; // Median is ix internalCheckNode() ; // y finished z.isLeaf = isLeaf ; z.setCount(maxRec - (ix + 1)) ; // Number copied into z // Caller puts the blocks in split(int, BTreePage) z.internalCheckNode() ; return z ; }
private static void copyBPTreeNode(BPTreeNode nodeSrc, BPTreeNode nodeDst, BPlusTree bpt2) { PtrBuffer pBuff = nodeSrc.getPtrBuffer() ; pBuff.copy(0, nodeDst.getPtrBuffer(), 0, pBuff.getSize()) ; RecordBuffer rBuff = nodeSrc.getRecordBuffer() ; rBuff.copy(0, nodeDst.getRecordBuffer(), 0, rBuff.getSize()) ; nodeDst.setCount(nodeSrc.getCount()) ; nodeDst.setIsLeaf(nodeSrc.isLeaf()) ; bpt2.getNodeManager().put(nodeDst) ; } }
private static void copyBPTreeNode(BPTreeNode nodeSrc, BPTreeNode nodeDst, BPlusTree bpt2) { PtrBuffer pBuff = nodeSrc.getPtrBuffer() ; pBuff.copy(0, nodeDst.getPtrBuffer(), 0, pBuff.getSize()) ; RecordBuffer rBuff = nodeSrc.getRecordBuffer() ; rBuff.copy(0, nodeDst.getRecordBuffer(), 0, rBuff.getSize()) ; nodeDst.setCount(nodeSrc.getCount()) ; nodeDst.setIsLeaf(nodeSrc.isLeaf()) ; bpt2.getNodeManager().put(nodeDst) ; } }
n.setCount(0) ; // Count is count of records. int rootId = n.getId() ; nodeManager.write(n) ;
n.setCount(0) ; // Count is count of records. int rootId = n.getId() ; nodeManager.write(n) ;