summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPavi Vetriselvan <pvselvan@umich.edu>2020-04-01 14:48:40 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-04-01 19:17:42 +0000
commit120555f4df938ff61110a63eeccadf9c3068d24b (patch)
tree517505ca3f987d74411c4d2263fd67619e20ed21 /src
parent40a3ba610db44735061b13f0a1703de1bc0a6f37 (diff)
downloadmongo-120555f4df938ff61110a63eeccadf9c3068d24b.tar.gz
Revert "SERVER-45094 check if node is primary before doing reconfig noop write"
This reverts commit 49836a791fbab2c8f3726450cda1d3c708eff90a.
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/repl/repl_set_commands.cpp36
1 files changed, 15 insertions, 21 deletions
diff --git a/src/mongo/db/repl/repl_set_commands.cpp b/src/mongo/db/repl/repl_set_commands.cpp
index 10940e05621..e3cfe46a459 100644
--- a/src/mongo/db/repl/repl_set_commands.cpp
+++ b/src/mongo/db/repl/repl_set_commands.cpp
@@ -45,7 +45,6 @@
#include "mongo/db/auth/action_set.h"
#include "mongo/db/auth/action_type.h"
#include "mongo/db/auth/authorization_session.h"
-#include "mongo/db/catalog_raii.h"
#include "mongo/db/commands.h"
#include "mongo/db/commands/server_status_metric.h"
#include "mongo/db/commands/test_commands_enabled.h"
@@ -420,26 +419,21 @@ public:
parsedArgs.force = cmdObj.hasField("force") && cmdObj["force"].trueValue();
auto status = replCoord->processReplSetReconfig(opCtx, parsedArgs, &result);
- {
- AutoGetOplog oplogWrite(opCtx, OplogAccessMode::kWrite);
- // Make sure we are primary before doing noop write.
- if (status.isOK() && !parsedArgs.force &&
- replCoord->canAcceptWritesForDatabase(opCtx, "admin")) {
- const auto service = opCtx->getServiceContext();
- Lock::GlobalLock globalLock(opCtx, MODE_IX);
- writeConflictRetry(opCtx, "replSetReconfig", kReplSetReconfigNss, [&] {
- WriteUnitOfWork wuow(opCtx);
- // Users must not be allowed to provide their own contents for the o2 field.
- // o2 field of no-ops is supposed to be used internally.
-
- service->getOpObserver()->onOpMessage(
- opCtx,
- BSON("msg"
- << "Reconfig set"
- << "version" << parsedArgs.newConfigObj["version"]));
- wuow.commit();
- });
- }
+ if (status.isOK() && !parsedArgs.force) {
+ const auto service = opCtx->getServiceContext();
+ Lock::GlobalLock globalLock(opCtx, MODE_IX);
+ writeConflictRetry(opCtx, "replSetReconfig", kReplSetReconfigNss, [&] {
+ WriteUnitOfWork wuow(opCtx);
+ // Users must not be allowed to provide their own contents for the o2 field.
+ // o2 field of no-ops is supposed to be used internally.
+
+ service->getOpObserver()->onOpMessage(opCtx,
+ BSON("msg"
+ << "Reconfig set"
+ << "version"
+ << parsedArgs.newConfigObj["version"]));
+ wuow.commit();
+ });
}
uassertStatusOK(status);