summaryrefslogtreecommitdiff
path: root/jstests/noPassthroughWithMongod/indexbg_restart_sigkill_secondary_noretry.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/noPassthroughWithMongod/indexbg_restart_sigkill_secondary_noretry.js')
-rw-r--r--jstests/noPassthroughWithMongod/indexbg_restart_sigkill_secondary_noretry.js52
1 files changed, 26 insertions, 26 deletions
diff --git a/jstests/noPassthroughWithMongod/indexbg_restart_sigkill_secondary_noretry.js b/jstests/noPassthroughWithMongod/indexbg_restart_sigkill_secondary_noretry.js
index c97d8320422..c7a793e2a51 100644
--- a/jstests/noPassthroughWithMongod/indexbg_restart_sigkill_secondary_noretry.js
+++ b/jstests/noPassthroughWithMongod/indexbg_restart_sigkill_secondary_noretry.js
@@ -14,7 +14,7 @@
* Start with noIndexBuildRetry option, should *not* build index on secondary
*/
-(function () {
+(function() {
var assert_trueTimeout = function(f, msg, timeout /*ms*/, interval) {
var start = new Date();
timeout = timeout || 30000;
@@ -28,12 +28,12 @@
if (diff > timeout)
return;
sleep(interval);
- }
+ }
};
// Set up replica set
- var replTest = new ReplSetTest({ name: 'bgIndexNoRetry', nodes: 3,
- nodeOptions : {noIndexBuildRetry:"", syncdelay:1} });
+ var replTest = new ReplSetTest(
+ {name: 'bgIndexNoRetry', nodes: 3, nodeOptions: {noIndexBuildRetry: "", syncdelay: 1}});
var nodenames = replTest.nodeList();
// We can't use an arbiter as the third node because the -auth test tries to log on there
@@ -47,11 +47,14 @@
return;
}
- replTest.initiate({"_id" : "bgIndexNoRetry",
- "members" : [
- {"_id" : 0, "host" : nodenames[0]},
- {"_id" : 1, "host" : nodenames[1]},
- {"_id" : 2, "host" : nodenames[2], arbiterOnly: true}]});
+ replTest.initiate({
+ "_id": "bgIndexNoRetry",
+ "members": [
+ {"_id": 0, "host": nodenames[0]},
+ {"_id": 1, "host": nodenames[1]},
+ {"_id": 2, "host": nodenames[2], arbiterOnly: true}
+ ]
+ });
var master = replTest.getPrimary();
var second = replTest.getSecondary();
@@ -65,18 +68,18 @@
jsTest.log("creating test data " + size + " documents");
var bulk = masterDB.jstests_bgsec.initializeUnorderedBulkOp();
- for( i = 0; i < size; ++i ) {
- bulk.insert({ i : i });
+ for (i = 0; i < size; ++i) {
+ bulk.insert({i: i});
}
assert.writeOK(bulk.execute());
jsTest.log("Starting background indexing");
- masterDB.jstests_bgsec.ensureIndex( {i:1}, {background:true} );
+ masterDB.jstests_bgsec.ensureIndex({i: 1}, {background: true});
assert.eq(2, masterDB.jstests_bgsec.getIndexes().length);
// Do one more write, so that later on, the secondary doesn't restart with the index build
// as the last op in the oplog -- it will redo this op otherwise.
- masterDB.jstests_bgsec.insert( { i : -1 } );
+ masterDB.jstests_bgsec.insert({i: -1});
// Wait for the secondary to get caught up
jsTest.log("Waiting for replication");
@@ -84,29 +87,26 @@
// Make sure a journal flush for the oplog occurs, by doing a local journaled write to the
// secondary
- assert.writeOK(second.getDB('local').foo.insert({ a: 1 }, { writeConcern: { j: true }}));
+ assert.writeOK(second.getDB('local').foo.insert({a: 1}, {writeConcern: {j: true}}));
// restart secondary and reconnect
jsTest.log("Restarting secondary");
- replTest.restart(secondId, {}, /*signal=*/ 9, /*wait=*/true);
+ replTest.restart(secondId, {}, /*signal=*/9, /*wait=*/true);
// Make sure secondary comes back
- assert.soon( function() {
+ assert.soon(function() {
try {
- secondDB.isMaster(); // trigger a reconnect if needed
+ secondDB.isMaster(); // trigger a reconnect if needed
return true;
} catch (e) {
- return false;
+ return false;
}
- } , "secondary didn't restart", 60000, 1000);
+ }, "secondary didn't restart", 60000, 1000);
- assert_trueTimeout(
- function() {
- return 2 == secondDB.jstests_bgsec.getIndexes().length;
- },
- "index created on secondary after restart with --noIndexBuildRetry",
- 30000, 200);
+ assert_trueTimeout(function() {
+ return 2 == secondDB.jstests_bgsec.getIndexes().length;
+ }, "index created on secondary after restart with --noIndexBuildRetry", 30000, 200);
- assert.neq(2, secondDB.jstests_bgsec.getIndexes().length );
+ assert.neq(2, secondDB.jstests_bgsec.getIndexes().length);
replTest.stopSet();
}());