diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2018-10-11 18:24:20 -0400 |
---|---|---|
committer | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2018-10-21 20:28:00 -0400 |
commit | 29e5df422d26f0ca6d43a6ed6a6d3456ff45efca (patch) | |
tree | cd5c68a2144b9ee5b785b016778e24cef2956216 /jstests | |
parent | 4141315e05b40168d845c494f255f7ef7d4f8cc0 (diff) | |
download | mongo-29e5df422d26f0ca6d43a6ed6a6d3456ff45efca.tar.gz |
SERVER-37055 IndexBuildBlock::fail() should grab a lock
(cherry picked from commit 0272ec068f5da65458d7a081beac583b33b610d1)
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/noPassthrough/indexbg_shutdown.js | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/jstests/noPassthrough/indexbg_shutdown.js b/jstests/noPassthrough/indexbg_shutdown.js index d226613c9e7..a02e9c04294 100644 --- a/jstests/noPassthrough/indexbg_shutdown.js +++ b/jstests/noPassthrough/indexbg_shutdown.js @@ -29,6 +29,8 @@ var master = replTest.getPrimary(); var second = replTest.getSecondary(); + var secondaryId = replTest.getNodeId(second); + var masterDB = master.getDB(dbname); var secondDB = second.getDB(dbname); @@ -36,7 +38,7 @@ jsTest.log("creating test data " + size + " documents"); var bulk = masterDB.getCollection(collection).initializeUnorderedBulkOp(); for (var i = 0; i < size; ++i) { - bulk.insert({i: i}); + bulk.insert({i: i, j: i * i}); } assert.writeOK(bulk.execute()); @@ -49,14 +51,19 @@ // the background index build finishes). assert.commandWorked(masterDB.runCommand({ createIndexes: collection, - indexes: [{key: {i: 1}, name: "i1", background: true}], + indexes: [ + {key: {i: -1, j: -1}, name: 'ij1', background: true}, + {key: {i: -1, j: 1}, name: 'ij2', background: true}, + {key: {i: 1, j: -1}, name: 'ij3', background: true}, + {key: {i: 1, j: 1}, name: 'ij4', background: true} + ], writeConcern: {w: 2} })); - assert.eq(2, masterDB.getCollection(collection).getIndexes().length); + assert.eq(5, masterDB.getCollection(collection).getIndexes().length); - // Secondary should shut down cleanly, and not return an fassert. This is checked when we - // shut down the ReplSetTest. - second.getDB("admin").shutdownServer(); + jsTest.log("Restarting secondary to retry replication"); + // Secondary should restart cleanly. + replTest.restart(secondaryId, {}, /*wait=*/true); replTest.stopSet(); }()); |