From 6883bdfb8b8cff32176b1fd176df04da9165fd67 Mon Sep 17 00:00:00 2001 From: Jack Mulrow Date: Thu, 2 Apr 2020 14:20:42 -0400 Subject: SERVER-29153 Wait for nodes to agree on primary before writes in ShardingTest setup (cherry picked from commit 85a915d3b49c0cd0b106f40df55a68a2f6779de1) --- src/mongo/shell/shardingtest.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mongo/shell/shardingtest.js b/src/mongo/shell/shardingtest.js index 0116254e67b..78472d843d5 100644 --- a/src/mongo/shell/shardingtest.js +++ b/src/mongo/shell/shardingtest.js @@ -1354,6 +1354,7 @@ var ShardingTest = function(params) { } var rs = this._rs[i].test; + rs.awaitNodesAgreeOnPrimary(); rs.getPrimary().getDB("admin").foo.save({x: 1}); if (keyFile) { @@ -1422,6 +1423,7 @@ var ShardingTest = function(params) { this.configRS.initiateWithAnyNodeAsPrimary(config); // Wait for master to be elected before starting mongos + this.configRS.awaitNodesAgreeOnPrimary(); var csrsPrimary = this.configRS.getPrimary(); // If 'otherParams.mongosOptions.binVersion' is an array value, then we'll end up constructing a -- cgit v1.2.1