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

isMaster can return isMaster: true while in drain mode

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Replication
    • Labels:
      None
    • ALL
    • Repl 2017-01-23, Repl 2017-02-13, Repl 2017-03-06, Repl 2017-03-27
    • 0

      Earlier in this code block _isWaitingForDrainToComplete is set to false, and at that point isMaster will begin to return true. This is because isMaster does not wait for _canAcceptNonLocalWrites to be true to return true (which it probably should). This, however, occurs before we write the "new primary" noop to the server and log that "transition to primary complete; database writes are now permitted", which should happen before drain mode is complete (especially the "new primary" noop).

      This code block also unlocks and relocks its mutex without checking if the state has changed afterwards, which should be reconsidered.

      Related, but tangential is that _isWaitingForDrainToComplete and _isCatchingUp and _canAcceptNonLocalWrites are all related but currently function as 3 separate booleans. We should investigate if they can be combined into an enum.

            Assignee:
            siyuan.zhou@mongodb.com Siyuan Zhou
            Reporter:
            judah.schvimer@mongodb.com Judah Schvimer
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: