summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/user_management_commands.cpp
diff options
context:
space:
mode:
authorSara Golemon <sara.golemon@mongodb.com>2021-03-24 14:24:34 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-03-24 14:57:52 +0000
commit636ced3b953a6b5dde3f8be7fb4a43f4958e7c4a (patch)
treebb728b145394fee0928c4a605cca42d9ab79de68 /src/mongo/db/commands/user_management_commands.cpp
parent8b64da4e43b7318a7ab8a7580708195b6de91200 (diff)
downloadmongo-636ced3b953a6b5dde3f8be7fb4a43f4958e7c4a.tar.gz
SERVER-55453 Retry dropRole command transactions harder in test mode
Diffstat (limited to 'src/mongo/db/commands/user_management_commands.cpp')
-rw-r--r--src/mongo/db/commands/user_management_commands.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mongo/db/commands/user_management_commands.cpp b/src/mongo/db/commands/user_management_commands.cpp
index 494789becc9..adae82a5251 100644
--- a/src/mongo/db/commands/user_management_commands.cpp
+++ b/src/mongo/db/commands/user_management_commands.cpp
@@ -58,6 +58,7 @@
#include "mongo/db/client.h"
#include "mongo/db/commands.h"
#include "mongo/db/commands/run_aggregate.h"
+#include "mongo/db/commands/test_commands.h"
#include "mongo/db/commands/user_management_commands_common.h"
#include "mongo/db/commands/user_management_commands_gen.h"
#include "mongo/db/concurrency/d_concurrency.h"
@@ -1777,7 +1778,10 @@ Status retryTransactionOps(OperationContext* opCtx,
// since its populated with the return from ops(),
// but guard against bit-rot by pre-populating a generic failure.
Status status(ErrorCodes::OperationFailed, "Operation was never attempted");
- constexpr int kMaxAttempts = 3;
+
+ // Be more patient with our test runner which is likely to be
+ // doing aggressive reelections and failovers and replication shenanigans.
+ const int kMaxAttempts = getTestCommandsEnabled() ? 10 : 3;
for (int tries = kMaxAttempts; tries > 0; --tries) {
if (tries < kMaxAttempts) {