summaryrefslogtreecommitdiff
path: root/jstests/index12.js
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-02-11 17:33:13 -0500
committerEliot Horowitz <eliot@10gen.com>2010-02-11 17:33:13 -0500
commit74d81e44b59ff57e81c3f64d8092fc3f31031bc5 (patch)
tree0f07795de70dae0ccde2a6b0d7172e642baa4042 /jstests/index12.js
parent5d44f01b1fb59093878d323f1ea254fdcf9301eb (diff)
downloadmongo-74d81e44b59ff57e81c3f64d8092fc3f31031bc5.tar.gz
moving bg stuff to slow
Diffstat (limited to 'jstests/index12.js')
-rw-r--r--jstests/index12.js83
1 files changed, 0 insertions, 83 deletions
diff --git a/jstests/index12.js b/jstests/index12.js
deleted file mode 100644
index f407c606ed3..00000000000
--- a/jstests/index12.js
+++ /dev/null
@@ -1,83 +0,0 @@
-// Test background index creation w/ constraints
-
-parallel = function() {
- return db[ baseName + "_parallelStatus" ];
-}
-
-resetParallel = function() {
- parallel().drop();
-}
-
-doParallel = function( work ) {
- resetParallel();
- startMongoProgramNoConnect( "mongo", "--eval", work + "; db." + baseName + "_parallelStatus.save( {done:1} );", db.getMongo().host );
-}
-
-doneParallel = function() {
- return !!parallel().findOne();
-}
-
-waitParallel = function() {
- assert.soon( function() { return doneParallel(); }, "parallel did not finish in time", 300000, 1000 );
-}
-
-doTest = function(dropDups) {
-
- size = 10000;
- while (1) { // if indexing finishes before we can run checks, try indexing w/ more data
- print("size: " + size);
- baseName = "jstests_index12";
- fullName = "db." + baseName;
- t = db[baseName];
- t.drop();
-
- db.eval(function(size) {
- for (i = 0; i < size; ++i) {
- db.jstests_index12.save({ i: i });
- }
- },
- size);
- assert.eq(size, t.count());
-
- doParallel(fullName + ".ensureIndex( {i:1}, {background:true, unique:true, dropDups:" + dropDups + "} )");
- try {
- // wait for indexing to start
- assert.soon(function() { return 2 == db.system.indexes.count({ ns: "test." + baseName }) }, "no index created", 30000, 50);
- t.save({ i: 0, n: true });
- //printjson(db.getLastError());
- t.save({ i: size - 1, n: true });
- //printjson(db.getLastError());
- } catch (e) {
- // only a failure if we're still indexing
- // wait for parallel status to update to reflect indexing status
- sleep(1000);
- if (!doneParallel()) {
- throw e;
- }
- }
- if (!doneParallel()) {
- break;
- }
- print("indexing finished too soon, retrying...");
- size *= 2;
- assert(size < 5000000, "unable to run checks in parallel with index creation");
- }
-
- waitParallel();
-
- if( dropDups == "true" ) {
- assert.eq(size, t.find().toArray().length, "full query failed");
- assert.eq(size, t.count(), "count failed");
- }
- else {
- /* without dropdups, it could be that there is more than size now but the index failed
- to build - which is valid. we check index isn't there.
- */
- if (t.count() != size)
- assert.eq(1, t.getIndexes().length, "change in # of elems yet index is there");
- }
-
-}
-
-doTest( "false" );
-doTest( "true" );