summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoustafa Maher <m.maher@10gen.com>2021-06-21 21:25:38 +0000
committerMoustafa Maher <m.maher@10gen.com>2021-06-22 18:22:50 +0000
commit20fabcca5d9c29f4eef0ab026b50c24a038c63f1 (patch)
tree7ac8bebda5086fcb9fa387a7fc8475dd8b74ff74
parent33ad68c0dc4bda897a5647608049422ae784a15e (diff)
downloadmongo-20fabcca5d9c29f4eef0ab026b50c24a038c63f1.tar.gz
SERVER-57875 stopReplicationOnSecondaries needs to wait for replication after changing CWWC
-rw-r--r--jstests/libs/write_concern_util.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/jstests/libs/write_concern_util.js b/jstests/libs/write_concern_util.js
index 456ac432571..80c6593507a 100644
--- a/jstests/libs/write_concern_util.js
+++ b/jstests/libs/write_concern_util.js
@@ -38,12 +38,14 @@ function stopServerReplication(conn, retryIntervalMS) {
}
}
-// Stops replication at all replicaset secondaries.
+// Stops replication at all replicaset secondaries. However, it might wait for replication before
+// stopping it.
function stopReplicationOnSecondaries(rs, changeReplicaSetDefaultWCToLocal = true) {
if (changeReplicaSetDefaultWCToLocal == true) {
// The default WC is majority and this test can't satisfy majority writes.
assert.commandWorked(rs.getPrimary().adminCommand(
{setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}, writeConcern: {w: "majority"}}));
+ rs.awaitReplication();
}
stopServerReplication(rs.getSecondaries());
}