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:29:56 +0000
commit4bd5f34f0274d8d8732cb827b7126c5bbb0424f0 (patch)
treeb3237c7280578655709cae2f1043cc66afd400d7
parentad5a34f47d27170f7a15b3d6c62daad0e29eaf31 (diff)
downloadmongo-4bd5f34f0274d8d8732cb827b7126c5bbb0424f0.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 5a12a83ed4c..4411b3014c1 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());