Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-9847

consensus.cpp is not very DRY

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.5.0
    • Component/s: Replication
    • Fully Compatible

      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);
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            dwight@mongodb.com Dwight Merriman
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: