diff options
Diffstat (limited to 'jstests/noPassthrough')
-rw-r--r-- | jstests/noPassthrough/indexbg_shutdown.js | 4 | ||||
-rw-r--r-- | jstests/noPassthrough/list_indexes_with_build_uuids.js | 13 | ||||
-rw-r--r-- | jstests/noPassthrough/timestamp_index_builds.js | 8 |
3 files changed, 16 insertions, 9 deletions
diff --git a/jstests/noPassthrough/indexbg_shutdown.js b/jstests/noPassthrough/indexbg_shutdown.js index 7907780140c..ae7d1f3c3e6 100644 --- a/jstests/noPassthrough/indexbg_shutdown.js +++ b/jstests/noPassthrough/indexbg_shutdown.js @@ -65,7 +65,6 @@ const indexSpecs = [ assert.commandWorked(masterDB.runCommand({ createIndexes: collection, indexes: indexSpecs, - writeConcern: {w: 2}, })); const indexes = masterColl.getIndexes(); // Number of indexes passed to createIndexes plus one for the _id index. @@ -87,6 +86,9 @@ checkLog.containsWithCount( jsTest.log("Restarting secondary to retry replication"); // Secondary should restart cleanly. +assert.commandWorked(second.adminCommand( + {configureFailPoint: 'leaveIndexBuildUnfinishedForShutdown', mode: 'alwaysOn'})); +IndexBuildTest.resumeIndexBuilds(second); replTest.restart(secondaryId, {}, /*wait=*/true); // There should again be a message for each index we tried to create, because the server diff --git a/jstests/noPassthrough/list_indexes_with_build_uuids.js b/jstests/noPassthrough/list_indexes_with_build_uuids.js index 102f6560c1e..938ffa67a76 100644 --- a/jstests/noPassthrough/list_indexes_with_build_uuids.js +++ b/jstests/noPassthrough/list_indexes_with_build_uuids.js @@ -6,6 +6,8 @@ (function() { 'use strict'; +load('jstests/noPassthrough/libs/index_build.js'); + const dbName = "test"; const collName = "coll"; @@ -49,16 +51,18 @@ assert.commandWorked(primaryDB.runCommand( replSet.waitForAllIndexBuildsToFinish(dbName, collName); // Start hanging index builds on the secondary. -assert.commandWorked(secondaryDB.adminCommand( - {configureFailPoint: "hangAfterStartingIndexBuild", mode: "alwaysOn"})); +IndexBuildTest.pauseIndexBuilds(secondary); // Build and hang on the second index. assert.commandWorked(primaryDB.runCommand({ createIndexes: collName, indexes: [{key: {j: 1}, name: secondIndexName, background: true}], - writeConcern: {w: 2} })); +// Wait for index builds to start on the secondary. +const opId = IndexBuildTest.waitForIndexBuildToStart(secondaryDB); +jsTestLog('Index builds started on secondary. Op ID of one of the builds: ' + opId); + // Check the listIndexes() output. let res = secondaryDB.runCommand({listIndexes: collName, includeBuildUUIDs: true}); @@ -74,8 +78,7 @@ assert.eq(indexes[2].spec.name, "second"); assert(indexes[2].hasOwnProperty("buildUUID")); // Allow the secondary to finish the index build. -assert.commandWorked( - secondaryDB.adminCommand({configureFailPoint: "hangAfterStartingIndexBuild", mode: "off"})); +IndexBuildTest.resumeIndexBuilds(secondary); replSet.stopSet(); }()); diff --git a/jstests/noPassthrough/timestamp_index_builds.js b/jstests/noPassthrough/timestamp_index_builds.js index 7b0613bfff0..5296dc44d8f 100644 --- a/jstests/noPassthrough/timestamp_index_builds.js +++ b/jstests/noPassthrough/timestamp_index_builds.js @@ -25,6 +25,8 @@ (function() { "use strict"; +load('jstests/noPassthrough/libs/index_build.js'); + const rst = new ReplSetTest({ name: "timestampingIndexBuilds", nodes: 2, @@ -74,7 +76,7 @@ for (let nodeIdx = 0; nodeIdx < 2; ++nodeIdx) { nodeIdentity); let conn = rst.start(nodeIdx, {noReplSet: true, noCleanData: true}); assert.neq(null, conn, "failed to restart node"); - assert.eq(1, getColl(conn).getIndexes().length); + IndexBuildTest.assertIndexes(getColl(conn), 1, ['_id_']); rst.stop(nodeIdx); } @@ -84,7 +86,7 @@ for (let nodeIdx = 0; nodeIdx < 2; ++nodeIdx) { jsTestLog("Starting as a replica set. Both indexes should exist. Node: " + nodeIdentity); let conn = rst.start(nodeIdx, {startClean: false}, true); conn.setSlaveOk(); - assert.eq(2, getColl(conn).getIndexes().length); + IndexBuildTest.assertIndexes(getColl(conn), 2, ['_id_', 'foo_1']); rst.stop(nodeIdx); } @@ -95,7 +97,7 @@ for (let nodeIdx = 0; nodeIdx < 2; ++nodeIdx) { nodeIdentity); let conn = rst.start(nodeIdx, {noReplSet: true, noCleanData: true}); assert.neq(null, conn, "failed to restart node"); - assert.eq(1, getColl(conn).getIndexes().length); + IndexBuildTest.assertIndexes(getColl(conn), 1, ['_id_']); rst.stop(nodeIdx); } } |