Permalink
Browse files

minor btree refactor

  • Loading branch information...
1 parent c860a13 commit 39b45bf3992e76f29edeb5c3ed1919515f8abf97 @astaple astaple committed Oct 27, 2010
Showing with 2 additions and 18 deletions.
  1. +2 −18 db/btree.cpp
View
@@ -597,24 +597,8 @@ namespace mongo {
assert( !isHead() );
BtreeBucket *p = parent.btreemod();
- if ( p->nextChild == thisLoc ) {
- p->nextChild.Null();
- }
- else {
- for ( int i = 0; i < p->n; i++ ) {
- if ( p->k(i).prevChildBucket == thisLoc ) {
- p->k(i).prevChildBucket.Null();
- goto found;
- }
- }
- out() << "ERROR: can't find ref to deleted bucket.\n";
- out() << "To delete:\n";
- dump();
- out() << "Parent:\n";
- p->dump();
- assert(false);
- }
-found:
+ int parentIdx = indexInParent( thisLoc );
+ p->child( parentIdx ).Null();
deallocBucket( thisLoc, id );
}

0 comments on commit 39b45bf

Please sign in to comment.