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

consensus.cpp is not very DRY

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Icon: Minor - P4 Minor - P4
    • None
    • 2.5.0
    • Replication
    • Fully Compatible

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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: