consensus.cpp is not very DRY

XMLWordPrintableJSON

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

      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
            Reporter:
            Dwight Merriman
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: