@Override final Record internalSearch(AccessPath path, Record rec) { if ( BPT.CheckingNode ) internalCheckNode() ; BPTreePage page = findHere(path, rec) ; Record r = page.internalSearch(path, rec) ; page.release() ; return r ; }
internalCheckNode() ; if ( BPT.CheckingNode ) { if ( !y.isFull() )
@Override final Record internalSearch(AccessPath path, Record rec) { if ( BPT.CheckingNode ) internalCheckNode() ; BPTreePage page = findHere(path, rec) ; Record r = page.internalSearch(path, rec) ; page.release() ; return r ; }
internalCheckNode() ; if ( BPT.CheckingNode ) { if ( !y.isFull() )
@Override Record shiftRight(BPTreePage other, Record splitKey) { BPTreeNode node = cast(other) ; if ( BPT.CheckingNode ) { if ( count == 0 ) BPT.error("Node is empty - can't shift a slot out") ; if ( node.isFull() ) BPT.error("Destination node is full") ; } // Records: promote moving element, replace with splitKey Record r = this.records.getHigh() ; this.records.removeTop() ; node.records.add(0, splitKey) ; // Pointers just shift this.ptrs.shiftRight(node.ptrs) ; this.count-- ; node.count++ ; this.internalCheckNode() ; node.internalCheckNode() ; return r ; }
@Override Record shiftRight(BPTreePage other, Record splitKey) { BPTreeNode node = cast(other) ; if ( BPT.CheckingNode ) { if ( count == 0 ) BPT.error("Node is empty - can't shift a slot out") ; if ( node.isFull() ) BPT.error("Destination node is full") ; } // Records: promote moving element, replace with splitKey Record r = this.records.getHigh() ; this.records.removeTop() ; node.records.add(0, splitKey) ; // Pointers just shift this.ptrs.shiftRight(node.ptrs) ; this.count-- ; node.count++ ; this.internalCheckNode() ; node.internalCheckNode() ; return r ; }
/** 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 BPTreeNode merge(BPTreeNode left, Record splitKey, BPTreeNode right) { // Merge blocks - does not adjust the parent. // Copy right to top of left. // Caller releases 'right' (needed for testing code). left.records.add(splitKey) ; // Copy over right to top of left. right.records.copyToTop(left.records) ; right.ptrs.copyToTop(left.ptrs) ; // Update count left.count = left.count + right.count + 1 ; left.internalCheckNode() ; right.records.clear() ; right.ptrs.clear() ; return left ; }
/** 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 BPTreeNode merge(BPTreeNode left, Record splitKey, BPTreeNode right) { // Merge blocks - does not adjust the parent. // Copy right to top of left. // Caller releases 'right' (needed for testing code). left.records.add(splitKey) ; // Copy over right to top of left. right.records.copyToTop(left.records) ; right.ptrs.copyToTop(left.ptrs) ; // Update count left.count = left.count + right.count + 1 ; left.internalCheckNode() ; right.records.clear() ; right.ptrs.clear() ; return left ; }
private void shuffleDown(int x) { // x is the index in the parent and may be on eover the end. if ( logging(log) ) { log(log, "ShuffleDown: i=%d count=%d MaxRec=%d", x, count, maxRecords()) ; log(log, "ShuffleDown >> %s", this) ; } if ( BPT.CheckingNode && x >= count ) BPT.error("shuffleDown out of bounds") ; // Just the top to clear if ( x == count - 1 ) { records.removeTop() ; ptrs.removeTop() ; count-- ; if ( logging(log) ) { log(log, "shuffleDown << Clear top") ; log(log, "shuffleDown << %s", this) ; } internalCheckNode() ; return ; } // Shuffle down. Removes key and pointer just above key. records.shiftDown(x) ; ptrs.shiftDown(x + 1) ; count-- ; if ( logging(log) ) log(log, "shuffleDown << %s", this) ; internalCheckNode() ; }
private void shuffleDown(int x) { // x is the index in the parent and may be on eover the end. if ( logging(log) ) { log(log, "ShuffleDown: i=%d count=%d MaxRec=%d", x, count, maxRecords()) ; log(log, "ShuffleDown >> %s", this) ; } if ( BPT.CheckingNode && x >= count ) BPT.error("shuffleDown out of bounds") ; // Just the top to clear if ( x == count - 1 ) { records.removeTop() ; ptrs.removeTop() ; count-- ; if ( logging(log) ) { log(log, "shuffleDown << Clear top") ; log(log, "shuffleDown << %s", this) ; } internalCheckNode() ; return ; } // Shuffle down. Removes key and pointer just above key. records.shiftDown(x) ; ptrs.shiftDown(x + 1) ; count-- ; if ( logging(log) ) log(log, "shuffleDown << %s", this) ; internalCheckNode() ; }
log(log, "internalInsert: %s [%s]", record, this) ; internalCheckNode() ; path.reset(this, idx, page); internalCheckNode() ;
log(log, "internalInsert: %s [%s]", record, this) ; internalCheckNode() ; path.reset(this, idx, page); internalCheckNode() ;
if ( ! root.isRoot() ) BPT.error("Not root: %d (root is id zero)", root.getId()) ; root.internalCheckNode() ; promoteRoot(root) ; root.internalCheckNode() ; left.internalCheckNode() ; right.internalCheckNode() ;
if ( ! root.isRoot() ) BPT.error("Not root: %d (root is id zero)", root.getId()) ; root.internalCheckNode() ; promoteRoot(root) ; root.internalCheckNode() ; left.internalCheckNode() ; right.internalCheckNode() ;
if ( logging(log) ) log(log, ">> internalDelete(%s) : %s", rec, this) ; internalCheckNode() ; resetTrackPath(path, this, y, page) ; if ( BPT.CheckingNode ) { internalCheckNode() ; page.checkNode() ;
if ( logging(log) ) log(log, ">> internalDelete(%s) : %s", rec, this) ; internalCheckNode() ; resetTrackPath(path, this, y, page) ; if ( BPT.CheckingNode ) { internalCheckNode() ; page.checkNode() ;
log(log, ">> node: %s", node) ; internalCheckNode() ; left.checkNode() ; node.checkNode() ; this.internalCheckNode() ; right.checkNode() ; node.checkNode() ; this.internalCheckNode() ;
log(log, ">> node: %s", node) ; internalCheckNode() ; left.checkNode() ; node.checkNode() ; this.internalCheckNode() ; right.checkNode() ; node.checkNode() ; this.internalCheckNode() ;