[SERVER-27490] Stop consulting storage engine isDurable flag in ReplicationCoordinatorImpl and simplify ReplCoordTestFixture Created: 21/Dec/16  Updated: 05/Apr/17  Resolved: 07/Jan/17

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: 3.5.2

Type: Improvement Priority: Major - P3
Reporter: Andy Schwerin Assignee: Andy Schwerin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-28376 ReplSetTest.initiate() should call aw... Closed
Backwards Compatibility: Fully Compatible
Sprint: Sharding 2017-01-02
Participants:

 Description   

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.

Further, the ReplCoordTestFixture and ReplicationCoordinatorImpl test-only constructor are more complex than necessary, and offer unused flexibility. This task also removes the unused behaviors and narrows the presented interface in order to make future enhancement easier.



 Comments   
Comment by Githook User [ 07/Jan/17 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}

Message: 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.
Branch: master
https://github.com/mongodb/mongo/commit/cdc7af4c6d453b8c1ce2319d0cd3b50074609d87

Generated at Thu Feb 08 04:15:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.