summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/replication_coordinator_impl_elect_v1.cpp
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@mongodb.com>2017-01-07 15:08:22 -0500
committerAndy Schwerin <schwerin@mongodb.com>2017-01-07 15:08:22 -0500
commitcdc7af4c6d453b8c1ce2319d0cd3b50074609d87 (patch)
tree681a5704ee7bdd32052dfe43ab1be03680b7a478 /src/mongo/db/repl/replication_coordinator_impl_elect_v1.cpp
parentef364240d7d48a8a352afb91df5cddbd34394021 (diff)
downloadmongo-cdc7af4c6d453b8c1ce2319d0cd3b50074609d87.tar.gz
SERVER-27490 Stop consulting storage engine isDurable flag in ReplicationCoordinatorImpl
... and simplify ReplCoordTestFixture ReplicationCoordinatorImpl consults the storage engine's isDurable flag for two purposes: 1. To choose whether to present the durable or applied optime when standing for election in pv1 2. To decide how to interpret w:majority without an explicit j field when waiting for write concern. In the first case, it is unnecessary to choose which optime to apply based on the isDurable flag. It is always safe and correct to present the applied optime, because if the node presenting it wins election, it will attempt to commit that applied optime. That means that voters may safely vote for that node. In the second case, using the value of the local node's storage engine's isDurable flag to adjust the meaning of w:majority is out of spec. Whether w:majority writes wait for journaling is a function only of the writeConcernMajorityJournalDefault flag when a write concern omits the "j" field. This patch removes the unnecessary consultation of the isDurable flag, and uses the opportunity to simplify the constructor of ReplicationCoordinatorImpl and its test fixture.
Diffstat (limited to 'src/mongo/db/repl/replication_coordinator_impl_elect_v1.cpp')
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl_elect_v1.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_impl_elect_v1.cpp b/src/mongo/db/repl/replication_coordinator_impl_elect_v1.cpp
index 9e72fdf9bc3..f97cb00acd3 100644
--- a/src/mongo/db/repl/replication_coordinator_impl_elect_v1.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl_elect_v1.cpp
@@ -123,9 +123,7 @@ void ReplicationCoordinatorImpl::_startElectSelfV1() {
invariant(_rsConfig.getMemberAt(_selfIndex).isElectable());
- // Note: If we aren't durable, send last applied.
- const auto lastOpTime = _isDurableStorageEngine() ? _getMyLastDurableOpTime_inlock()
- : _getMyLastAppliedOpTime_inlock();
+ const auto lastOpTime = _getMyLastAppliedOpTime_inlock();
if (lastOpTime == OpTime()) {
log() << "not trying to elect self, "
@@ -234,8 +232,7 @@ void ReplicationCoordinatorImpl::_startVoteRequester(long long newTerm) {
LockGuard lk(_topoMutex);
- const auto lastOpTime =
- _isDurableStorageEngine() ? getMyLastDurableOpTime() : getMyLastAppliedOpTime();
+ const auto lastOpTime = getMyLastAppliedOpTime();
_voteRequester.reset(new VoteRequester);
StatusWith<ReplicationExecutor::EventHandle> nextPhaseEvh = _voteRequester->start(