diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2021-11-19 17:52:39 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-11-19 18:35:24 +0000 |
commit | b0ac4a3fb1790cf868f2258d6f18f07acd539ffc (patch) | |
tree | 28796c8b8dc5d2f5d4d572a6e99d98ab8584ec0c /jstests | |
parent | 7901c26a4faf1360d81aace7ecb65a0826404e85 (diff) | |
download | mongo-b0ac4a3fb1790cf868f2258d6f18f07acd539ffc.tar.gz |
SERVER-61626 Fix index build race in drop_ready_index_while_building_an_index.js
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/noPassthrough/drop_ready_index_while_building_an_index.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/jstests/noPassthrough/drop_ready_index_while_building_an_index.js b/jstests/noPassthrough/drop_ready_index_while_building_an_index.js index 6875b06c194..7f03686f0ca 100644 --- a/jstests/noPassthrough/drop_ready_index_while_building_an_index.js +++ b/jstests/noPassthrough/drop_ready_index_while_building_an_index.js @@ -21,7 +21,8 @@ const collName = jsTestName(); const db = primary.getDB(dbName); const coll = db.getCollection(collName); -const secondaryColl = secondary.getDB(dbName).getCollection(collName); +const secondaryDB = secondary.getDB(dbName); +const secondaryColl = secondaryDB.getCollection(collName); assert.commandWorked(db.createCollection(collName)); @@ -32,9 +33,12 @@ for (let i = 0; i < 5; i++) { assert.commandWorked(coll.createIndex({x: 1}, {name: "x_1"})); IndexBuildTest.pauseIndexBuilds(primary); +IndexBuildTest.pauseIndexBuilds(secondary); + const awaitIndexBuild = IndexBuildTest.startIndexBuild(db.getMongo(), coll.getFullName(), {y: 1}, {name: "y_1"}); IndexBuildTest.waitForIndexBuildToScanCollection(db, collName, "y_1"); +IndexBuildTest.waitForIndexBuildToScanCollection(secondaryDB, collName, "y_1"); IndexBuildTest.assertIndexes( coll, /*numIndexes=*/3, /*readyIndexes=*/["_id_", "x_1"], /*notReadyIndexes=*/["y_1"]); @@ -51,7 +55,10 @@ IndexBuildTest.assertIndexes( secondaryColl, /*numIndexes=*/2, /*readyIndexes=*/["_id_"], /*notReadyIndexes=*/["y_1"]); IndexBuildTest.resumeIndexBuilds(primary); +IndexBuildTest.resumeIndexBuilds(secondary); + awaitIndexBuild(); +rst.awaitReplication(); IndexBuildTest.assertIndexes( coll, /*numIndexes=*/2, /*readyIndexes=*/["_id_", "y_1"], /*notReadyIndexes=*/[]); |