Details
-
Bug
-
Resolution: Done
-
Major - P3
-
None
-
None
-
ALL
Description
It looks like BtreeCursorImpl::keyAt() checks a v1 index sentinel value for n but not the corresponding (and different) v0 index sentinel value. This causes scary looking assertions in DEBUG mode, but fortunately everything ends up working fine in a normal build. Test below only fails in DEBUG mode.
diff --git a/db/btreecursor.cpp b/db/btreecursor.cpp
|
index f39d5bb..f81c2ec 100644
|
--- a/db/btreecursor.cpp
|
+++ b/db/btreecursor.cpp
|
@@ -52,7 +52,7 @@ namespace mongo {
|
assert( !bucket.isNull() );
|
const BtreeBucket<V> *b = bucket.btree<V>();
|
int n = b->getN();
|
- if( n == 0xffff ) {
|
+ if( n == 0xffff || n == -1 ) {
|
throw UserException(15850, "keyAt bucket deleted");
|
}
|
dassert( n >= 0 && n < 10000 );
|
diff --git a/jstests/removea.js b/jstests/removea.js
|
new file mode 100644
|
index 0000000..2ed3d60
|
--- /dev/null
|
+++ b/jstests/removea.js
|
@@ -0,0 +1,19 @@
|
+// Test removal of a substantial proportion of inserted elements.
|
+
|
+t = db.jstests_removea;
|
+t.drop();
|
+
|
+Random.setRandomSeed(1);
|
+
|
+for( v = 0; v < 2; ++v ) {
|
+ t.ensureIndex({a:1}, {v:v});
|
+ for( i = 0; i < 10000; ++i ) {
|
+ t.save( {a:i} );
|
+ }
|
+ toDrop = [];
|
+ for( i = 0; i < 10000; ++i ) {
|
+ toDrop.push( Random.randInt(10000) );
|
+ }
|
+ t.remove( {a:{$in:toDrop}} );
|
+ assert( !db.getLastError() );
|
+}
|
Attachments
Issue Links
- is related to
-
SERVER-4575 two somewhat redundant procedures for updating btree cursors when a btree bucket is deallocated; invalid debug warning
-
- Closed
-