diff options
author | Wenbin Zhu <wenbin.zhu@mongodb.com> | 2021-10-25 22:06:34 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-11-12 18:08:19 +0000 |
commit | 12682a2d8259210a7ab19606985de31fefde252b (patch) | |
tree | 8f87108207dfa7d4b786a7c4c1b8e83cc3b1398b /src | |
parent | d45c116321f1599c20313546cefedb749cf7c866 (diff) | |
download | mongo-12682a2d8259210a7ab19606985de31fefde252b.tar.gz |
SERVER-60946 Retry NotWritablePrimary error when initiating replset to handle concurrent priority takeover.
(cherry picked from commit d2d7164bb02fff924ac787f6d422dffb22ef0b94)
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/shell/replsettest.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mongo/shell/replsettest.js b/src/mongo/shell/replsettest.js index 905346b8ff3..a5f23ff892c 100644 --- a/src/mongo/shell/replsettest.js +++ b/src/mongo/shell/replsettest.js @@ -1521,6 +1521,7 @@ var ReplSetTest = function(opts) { for (let i = 2; i <= originalMembers.length; i++) { print("ReplSetTest adding in node " + i); assert.soon(function() { + primary = self.getPrimary().getDB("admin"); const statusRes = assert.commandWorked(primary.adminCommand({replSetGetStatus: 1})); const primaryMember = statusRes.members.find((m) => m.self); @@ -1535,7 +1536,8 @@ var ReplSetTest = function(opts) { ErrorCodes.NewReplicaSetConfigurationIncompatible, ErrorCodes.InterruptedDueToReplStateChange, ErrorCodes.ConfigurationInProgress, - ErrorCodes.CurrentConfigNotCommittedYet + ErrorCodes.CurrentConfigNotCommittedYet, + ErrorCodes.NotWritablePrimary ]; if (retryableReconfigCodes.includes(reconfigRes.code)) { print("Retrying reconfig due to " + tojsononeline(reconfigRes)); |