diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2019-02-14 16:15:50 -0500 |
---|---|---|
committer | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2019-02-22 21:12:50 -0500 |
commit | 0f2da7fb758f12bd64c6c7891d455a53e1ab1d89 (patch) | |
tree | d21c7a099c802971bea6059041da5b3b15365079 /src/mongo/db/repl | |
parent | 4253bddd476f19fb6af295323acc9d5af15da598 (diff) | |
download | mongo-0f2da7fb758f12bd64c6c7891d455a53e1ab1d89.tar.gz |
SERVER-37954 Thread commitQuorum through the createIndexes command into the Coordinator
Diffstat (limited to 'src/mongo/db/repl')
-rw-r--r-- | src/mongo/db/repl/oplog.cpp | 7 | ||||
-rw-r--r-- | src/mongo/db/repl/repl_set_config.cpp | 6 | ||||
-rw-r--r-- | src/mongo/db/repl/repl_set_config.h | 5 |
3 files changed, 17 insertions, 1 deletions
diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp index 509a47cbc36..60686355eec 100644 --- a/src/mongo/db/repl/oplog.cpp +++ b/src/mongo/db/repl/oplog.cpp @@ -287,13 +287,18 @@ Status startIndexBuild(OperationContext* opCtx, if (!statusWithIndexes.isOK()) { return statusWithIndexes.getStatus(); } + + IndexBuildsCoordinator::IndexBuildOptions indexBuildOptions = {/*commitQuorum=*/boost::none}; + + // We don't pass in a commit quorum here because secondary nodes don't have any knowledge of it. return IndexBuildsCoordinator::get(opCtx) ->startIndexBuild(opCtx, collUUID, statusWithIndexes.getValue(), indexBuildUUID, /* This oplog entry is only replicated for two-phase index builds */ - IndexBuildProtocol::kTwoPhase) + IndexBuildProtocol::kTwoPhase, + indexBuildOptions) .getStatus(); } diff --git a/src/mongo/db/repl/repl_set_config.cpp b/src/mongo/db/repl/repl_set_config.cpp index 0bada070ca7..2f5b4c5d5b8 100644 --- a/src/mongo/db/repl/repl_set_config.cpp +++ b/src/mongo/db/repl/repl_set_config.cpp @@ -646,6 +646,12 @@ Status ReplSetConfig::checkIfWriteConcernCanBeSatisfied( } } +int ReplSetConfig::getNumDataBearingMembers() const { + int numArbiters = + std::count_if(begin(_members), end(_members), [](const auto& x) { return x.isArbiter(); }); + return _members.size() - numArbiters; +} + const MemberConfig& ReplSetConfig::getMemberAt(size_t i) const { invariant(i < _members.size()); return _members[i]; diff --git a/src/mongo/db/repl/repl_set_config.h b/src/mongo/db/repl/repl_set_config.h index 3f45f0a5721..c3de46ea033 100644 --- a/src/mongo/db/repl/repl_set_config.h +++ b/src/mongo/db/repl/repl_set_config.h @@ -142,6 +142,11 @@ public: } /** + * Gets the number of data-bearing members in this configuration. + */ + int getNumDataBearingMembers() const; + + /** * Gets a begin iterator over the MemberConfigs stored in this ReplSetConfig. */ MemberIterator membersBegin() const { |