summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/mr.cpp
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@mongodb.com>2014-12-09 11:21:50 -0500
committerAndy Schwerin <schwerin@mongodb.com>2014-12-10 18:33:41 -0500
commit98a7e7f9709413ce06f49b48dee98f7080505947 (patch)
tree967f77dd7247a37831d579e7a993c9b818ee20d8 /src/mongo/db/commands/mr.cpp
parent8e3fe7f38c3d1ae8e072839bd4e2aaf78e19783c (diff)
downloadmongo-98a7e7f9709413ce06f49b48dee98f7080505947.tar.gz
SERVER-16500 Change the meaning of getReplicationMode() to be constant after start up.
Previously, ReplicationCoordinator::getReplicationMode() returned modeNone if the settings object indicated the node was part of a replica set, but no valid replica set configuration had yet been discovered. With this change, the settings object is the sole determinant of the return value of getReplicationMode(). Callers that wish to know if a replica set member is initialized should instead check ReplicationCoordinator::getMemberState(). If the value is RS_STARTUP, then the node is not initialized with a replica set config. This has the side-effect of removing the mutex in ReplCoordinatorImpl from the code path for this method.
Diffstat (limited to 'src/mongo/db/commands/mr.cpp')
-rw-r--r--src/mongo/db/commands/mr.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp
index c9755ee3e38..455bebb06f7 100644
--- a/src/mongo/db/commands/mr.cpp
+++ b/src/mongo/db/commands/mr.cpp
@@ -1297,11 +1297,11 @@ namespace mongo {
errmsg = "ns doesn't exist";
return false;
}
- repl::ReplicationCoordinator* replCoord = repl::getGlobalReplicationCoordinator();
- if (replCoord->getReplicationMode() == repl::ReplicationCoordinator::modeReplSet
- && state.isOnDisk()) {
+ if (state.isOnDisk()) {
// this means that it will be doing a write operation, make sure we are on Master
// ideally this check should be in slaveOk(), but at that point config is not known
+ repl::ReplicationCoordinator* const replCoord =
+ repl::getGlobalReplicationCoordinator();
if (!replCoord->canAcceptWritesForDatabase(dbname)) {
errmsg = "not master";
return false;