summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvia Surroca <silvia.surroca@mongodb.com>2023-04-11 13:59:48 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-04-12 11:05:39 +0000
commitd2652fd6b67f9f6e03cc45b4a00b3a99a804058b (patch)
tree7a9d380fe46d93374c7813e6aec138c0ad56c60d
parente19b996a2d05a3a1a8f361b73f5d50fa36a451b3 (diff)
downloadmongo-d2652fd6b67f9f6e03cc45b4a00b3a99a804058b.tar.gz
SERVER-73877 Wait for shard to have a primary before doing a migration in prepare_transaction_then_migrate.js
(cherry picked from commit b7b9d352b9566fe8b4c66eff66f695932b036f54)
-rw-r--r--jstests/sharding/prepare_transaction_then_migrate.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/jstests/sharding/prepare_transaction_then_migrate.js b/jstests/sharding/prepare_transaction_then_migrate.js
index 3389495e18d..4f439ac908e 100644
--- a/jstests/sharding/prepare_transaction_then_migrate.js
+++ b/jstests/sharding/prepare_transaction_then_migrate.js
@@ -9,6 +9,7 @@
(function() {
"use strict";
load('jstests/libs/chunk_manipulation_util.js');
+load('jstests/replsets/rslib.js');
load('jstests/sharding/libs/create_sharded_collection_util.js');
load('jstests/sharding/libs/sharded_transactions_helpers.js');
@@ -92,6 +93,12 @@ let runTest = function(testMode) {
if (testMode == TestMode.kWithStepUp) {
st.rs0.stepUp(st.rs0.getSecondary());
+
+ // Wait for the config server to see the new primary.
+ // TODO SERVER-74177 Remove this once retry on NotWritablePrimary is implemented.
+ st.forEachConfigServer((conn) => {
+ awaitRSClientHosts(conn, st.rs0.getPrimary(), {ok: true, ismaster: true});
+ });
} else if (testMode == TestMode.kWithRestart) {
TestData.skipCollectionAndIndexValidation = true;
st.rs0.restart(st.rs0.getPrimary());