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

Flush buffer before changing sync targets to prevent unnecessary rollbacks

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.4.0-rc0, 2.5.0
    • Affects Version/s: 2.2.2
    • Component/s: Replication
    • None
    • ALL
    • 0

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

            Assignee:
            milkie@mongodb.com Eric Milkie
            Reporter:
            kristina Kristina Chodorow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: