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

Flush buffer before changing sync targets to prevent unnecessary rollbacks

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.2.2
    • Fix Version/s: 2.4.0-rc0, 2.5.0
    • Component/s: Replication
    • Labels:
      None
    • Operating System:
      ALL
    • Case:
    • Linked BF Score:
      0

      Description

      The problem is with bgsync.cpp here:

      if (theirTS < _lastOpTimeFetched) {
          log() << "replSet we are ahead of the primary, will try to roll back" << rsLog;
          theReplSet->syncRollback(r);
          return true;
      }

      If we're syncing from the primary, then this logic is valid. If we are not, then this member must have applied some ops from the buffer and got ahead of the sync source, which is okay and we don't want to rollback. Probably the right fix is to make sure the buffer is empty before choosing a new sync target.

      This is a fairly annoying bug to run into. If the member is in the middle of applying a batch of ops, the rollback will fail (because you're not at minvalid) and put the member into FATAL state. (I think restarting should fix it, though.)

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: