@Override protected String typeMark() { String mark = isLeaf() ? "Leaf" : "Node" ; if ( isRoot() ) mark = mark+"/Root" ; return mark ; }
@Override protected String typeMark() { String mark = isLeaf() ? "Leaf" : "Node" ; if ( isRoot() ) mark = mark+"/Root" ; return mark ; }
@Override final void checkNodeDeep() { if ( isRoot() ) { // if ( !isLeaf && count == 0 ) // error("Root is of size zero (one pointer) but not a leaf") ; if ( parent != BPlusTreeParams.RootParent ) BPT.error("Root parent is wrong") ; // if ( count == 0 ) // return ; } checkNodeDeep(null, null) ; }
@Override final void checkNodeDeep() { if ( isRoot() ) { // if ( !isLeaf && count == 0 ) // error("Root is of size zero (one pointer) but not a leaf") ; if ( parent != BPlusTreeParams.RootParent ) BPT.error("Root parent is wrong") ; // if ( count == 0 ) // return ; } checkNodeDeep(null, null) ; }
/** Promote a B+Tree root */ static boolean promoteRoot(BPTreeNode root) { if ( ! root.isRoot() ) throw new InternalErrorException("Not a root") ; boolean changed = root.promote() ; root.bpTree.newRoot(root) ; return changed ; }
/** Promote a B+Tree root */ static boolean promoteRoot(BPTreeNode root) { if ( ! root.isRoot() ) throw new InternalErrorException("Not a root") ; boolean changed = root.promote() ; root.bpTree.newRoot(root) ; return changed ; }
/** Return true if there are no keys here or below this node */ @Override final boolean hasAnyKeys() { if ( this.count > 0 ) return true ; if ( !isRoot() ) return false ; // The root can be zero size and point to a single data block. BPTreePage page = get(0) ; boolean b = page.hasAnyKeys() ; page.release() ; return b ; }
/** Return true if there are no keys here or below this node */ @Override final boolean hasAnyKeys() { if ( this.count > 0 ) return true ; if ( !isRoot() ) return false ; // The root can be zero size and point to a single data block. BPTreePage page = get(0) ; boolean b = page.hasAnyKeys() ; page.release() ; return b ; }
/** Find a record, using the active comparator */ public static Record search(BPTreeNode root, Record rec) { root.internalCheckNodeDeep() ; if ( ! root.isRoot() ) throw new BPTreeException("Search not starting from the root: " + root) ; AccessPath path = new AccessPath(root) ; Record r = root.internalSearch(path, rec) ; return r ; }
/** Find a record, using the active comparator */ public static Record search(BPTreeNode root, Record rec) { root.internalCheckNodeDeep() ; if ( ! root.isRoot() ) throw new BPTreeException("Search not starting from the root: " + root) ; AccessPath path = new AccessPath(root) ; Record r = root.internalSearch(path, rec) ; return r ; }
log(pageLog, " << %s", n) ; if ( n.isRoot() ) { if ( newRoot != null) throw new InternalErrorException("New root already found") ;
/** Insert a record - return existing value if any, else null */ public static Record insert(BPTreeNode root, Record record) { if ( logging(log) ) { log(log, "** insert(%s) / root=%d", record, root.getId()) ; if ( DumpTree ) root.dump() ; } if ( !root.isRoot() ) throw new BPTreeException("Insert begins but this is not the root") ; if ( root.isFull() ) { // Root full - root split is a special case. splitRoot(root) ; if ( DumpTree ) root.dump() ; } AccessPath path = new AccessPath(root) ; // Root ready - call insert proper. Record result = root.internalInsert(path, record) ; root.internalCheckNodeDeep() ; if ( logging(log) ) { log(log, "** insert(%s) / finish", record) ; if ( DumpTree ) root.dump() ; } return result ; }
/** Insert a record - return existing value if any, else null */ public static Record insert(BPTreeNode root, Record record) { if ( logging(log) ) { log(log, "** insert(%s) / root=%d", record, root.getId()) ; if ( DumpTree ) root.dump() ; } if ( !root.isRoot() ) throw new BPTreeException("Insert begins but this is not the root") ; if ( root.isFull() ) { // Root full - root split is a special case. splitRoot(root) ; if ( DumpTree ) root.dump() ; } AccessPath path = new AccessPath(root) ; // Root ready - call insert proper. Record result = root.internalInsert(path, record) ; root.internalCheckNodeDeep() ; if ( logging(log) ) { log(log, "** insert(%s) / finish", record) ; if ( DumpTree ) root.dump() ; } return result ; }
log(log, "reduceRoot >> %s", root) ; if ( BPT.CheckingNode && (!root.isRoot() || root.count != 0) ) BPT.error("Not an empty root") ;
log(log, "reduceRoot >> %s", root) ; if ( BPT.CheckingNode && (!root.isRoot() || root.count != 0) ) BPT.error("Not an empty root") ;
root.dump() ; if ( !root.isRoot() ) throw new BPTreeException("Delete begins but this is not the root") ;
root.dump() ; if ( !root.isRoot() ) throw new BPTreeException("Delete begins but this is not the root") ;
if ( ! root.isRoot() ) BPT.error("Not root: %d (root is id zero)", root.getId()) ; root.internalCheckNode() ;
if ( ! root.isRoot() ) BPT.error("Not root: %d (root is id zero)", root.getId()) ; root.internalCheckNode() ;