summaryrefslogtreecommitdiff
path: root/jstests/queryoptimizer3.js
diff options
context:
space:
mode:
authorAntonin Kral <a.kral@bobek.cz>2012-03-01 13:43:25 +0100
committerAntonin Kral <a.kral@bobek.cz>2012-03-01 13:43:25 +0100
commitba59b00736b5b8dc0f0bd46397575aaf0cd4d44f (patch)
tree6364cf3f69677758a13f7aa5f6f06a8ebb652d98 /jstests/queryoptimizer3.js
parentf0d9a01bccdaeb466c12c92057914bbfef59526c (diff)
downloadmongodb-ba59b00736b5b8dc0f0bd46397575aaf0cd4d44f.tar.gz
Imported Upstream version 2.0.3
Diffstat (limited to 'jstests/queryoptimizer3.js')
-rw-r--r--jstests/queryoptimizer3.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/jstests/queryoptimizer3.js b/jstests/queryoptimizer3.js
new file mode 100644
index 0000000..76bc5b6
--- /dev/null
+++ b/jstests/queryoptimizer3.js
@@ -0,0 +1,33 @@
+// Check cases where index scans are aborted due to the collection being dropped.
+
+t = db.jstests_queryoptimizer3;
+t.drop();
+
+p = startParallelShell( 'for( i = 0; i < 400; ++i ) { sleep( 50 ); db.jstests_queryoptimizer3.drop(); }' );
+
+for( i = 0; i < 100; ++i ) {
+ t.drop();
+ t.ensureIndex({a:1});
+ t.ensureIndex({b:1});
+ for( j = 0; j < 100; ++j ) {
+ t.save({a:j,b:j});
+ }
+ m = i % 5;
+ if ( m == 0 ) {
+ t.count({a:{$gte:0},b:{$gte:0}});
+ }
+ else if ( m == 1 ) {
+ t.find({a:{$gte:0},b:{$gte:0}}).itcount();
+ }
+ else if ( m == 2 ) {
+ t.remove({a:{$gte:0},b:{$gte:0}});
+ }
+ else if ( m == 3 ) {
+ t.update({a:{$gte:0},b:{$gte:0}},{});
+ }
+ else if ( m == 4 ) {
+ t.distinct('x',{a:{$gte:0},b:{$gte:0}});
+ }
+}
+
+p();