summaryrefslogtreecommitdiff
path: root/jstests/noPassthroughWithMongod/index_killop.js
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2014-05-06 19:00:56 -0400
committerDavid Storch <david.storch@10gen.com>2014-05-06 19:00:56 -0400
commit72380726608df663a85bee24d69a20ed2ca8287d (patch)
tree735b7724ddc814fdf385d754bd7921975b5de491 /jstests/noPassthroughWithMongod/index_killop.js
parent3061ab54eb2cc642a279becfca0b93f5e17db117 (diff)
downloadmongo-72380726608df663a85bee24d69a20ed2ca8287d.tar.gz
Revert "SERVER-13741 Migrate remaining tests to use write commands"
This reverts commit 87dc3ae516e1d12a632dc604710661e38ed7b3dd.
Diffstat (limited to 'jstests/noPassthroughWithMongod/index_killop.js')
-rw-r--r--jstests/noPassthroughWithMongod/index_killop.js14
1 files changed, 6 insertions, 8 deletions
diff --git a/jstests/noPassthroughWithMongod/index_killop.js b/jstests/noPassthroughWithMongod/index_killop.js
index f897f6a80de..b022e31f3b8 100644
--- a/jstests/noPassthroughWithMongod/index_killop.js
+++ b/jstests/noPassthroughWithMongod/index_killop.js
@@ -5,11 +5,10 @@ t.drop();
// Insert a large number of documents, enough to ensure that an index build on these documents will
// be interrupted before complete.
-var bulk = t.initializeUnorderedBulkOp();
for( i = 0; i < 1e6; ++i ) {
- bulk.insert({ a: i });
+ t.save( { a:i } );
}
-assert.writeOK(bulk.execute());
+db.getLastError();
function debug( x ) {
// printjson( x );
@@ -24,7 +23,7 @@ function getIndexBuildOpId() {
// Identify the index build as an insert into the 'test.system.indexes'
// namespace. It is assumed that no other clients are concurrently
// accessing the 'test' database.
- if ( op.op == 'query' && 'createIndexes' in op.query ) {
+ if ( op.op == 'insert' && op.ns == 'test.system.indexes' ) {
debug( op.opid );
indexBuildOpId = op.opid;
}
@@ -34,8 +33,9 @@ function getIndexBuildOpId() {
/** Test that building an index with @param 'options' can be aborted using killop. */
function testAbortIndexBuild( options ) {
- var createIdx = startParallelShell('var coll = db.jstests_slownightly_index_killop; \
- coll.createIndex({ a: 1 }, ' + tojson(options) + ');');
+
+ // Create an index asynchronously by using a new connection.
+ new Mongo( db.getMongo().host ).getCollection( t.toString() ).createIndex( { a:1 }, options );
// When the index build starts, find its op id.
assert.soon( function() { return ( opId = getIndexBuildOpId() ) != -1; } );
@@ -44,8 +44,6 @@ function testAbortIndexBuild( options ) {
// Wait for the index build to stop.
assert.soon( function() { return getIndexBuildOpId() == -1; } );
- createIdx();
-
// Check that no new index has been created. This verifies that the index build was aborted
// rather than successfully completed.
assert.eq( [ { _id:1 } ], t.getIndexKeys() );