[SERVER-9847] consensus.cpp is not very DRY Created: 02/Jun/13  Updated: 10/Dec/14  Resolved: 17/Jun/14

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

Type: Improvement Priority: Minor - P4
Reporter: Dwight Merriman Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: elections
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Participants:

 Description   

There is a lot of repeating ourself in consensus.cpp so proposing that be cleaned up.

See also:
https://groups.google.com/forum/?hl=en-US&fromgroups#!topic/mongodb-dev/lH3hs8h7NrE

Also while we're at it, in the same area, consensus.cpp, when the following if statement fires, we set "fresher" to true whereas in this case it could be that someelse else is the one that is fresher. this likely works but is confusing. perhaps just s/weAreFresher/someoneIsFresher :

            // check not only our own optime, but any other member we can reach
            else if( opTime < theReplSet->lastOpTimeWritten ||
                     opTime < theReplSet->lastOtherOpTime())  {
                weAreFresher = true;
            }
            result.appendDate("opTime", theReplSet->lastOpTimeWritten.asDate());
            result.append("fresher", weAreFresher);



 Comments   
Comment by Eric Milkie [ 17/Jun/14 ]

consensus.cpp is getting rewritten as part of the replication refactor work for 2.8.

Generated at Thu Feb 08 03:21:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.