From 763fbdc180f5cee8c36c177ae59ac14a6f01f48b Mon Sep 17 00:00:00 2001 From: Zixuan Zhuang Date: Mon, 6 Feb 2023 14:15:31 +0000 Subject: SERVER-70219 fix spill_to_disk_secondary_read --- jstests/noPassthrough/spill_to_disk_secondary_read.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/jstests/noPassthrough/spill_to_disk_secondary_read.js b/jstests/noPassthrough/spill_to_disk_secondary_read.js index f4c2ef20104..be11fb3de70 100644 --- a/jstests/noPassthrough/spill_to_disk_secondary_read.js +++ b/jstests/noPassthrough/spill_to_disk_secondary_read.js @@ -9,8 +9,9 @@ load("jstests/libs/sbe_explain_helpers.js"); // For getSbePlanStages. load("jstests/libs/sbe_util.js"); // For checkSBEEnabled. +const kNumNodes = 3; const replTest = new ReplSetTest({ - nodes: 3, + nodes: kNumNodes, }); replTest.startSet(); @@ -20,15 +21,18 @@ replTest.initiate(); * Setup the primary and secondary collections. */ let primary = replTest.getPrimary(); -const insertColl = primary.getDB("test").foo; +let bulk = primary.getDB("test").foo.initializeUnorderedBulkOp(); const cRecords = 50; for (let i = 0; i < cRecords; ++i) { // We'll be using a unique 'key' field for group & lookup, but we cannot use '_id' for this, // because '_id' is indexed and would trigger Indexed Loop Join instead of Hash Join. - assert.commandWorked(insertColl.insert({key: i, string: "test test test"})); + bulk.insert({key: i, string: "test test test"}); } +assert.commandWorked(bulk.execute({w: kNumNodes, wtimeout: 5000})); let secondary = replTest.getSecondary(); +// Wait for the insertion to be visible on 'secondary'. +replTest.awaitLastOpCommitted(null, [secondary]); const readColl = secondary.getDB("test").foo; /** -- cgit v1.2.1