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

Race between stepdown and retrying write operation

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.0.0-rc5, 5.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • v5.0
    • Repl 2021-06-28
    • 69

      When using a non-w:1 write concern, waiting for write concern will fail if the primary steps down. If the write is retried before the former primary updates its state, then the same node will attempt to complete the write. In the case of a collection creation or drop, the node will error because the operation already happened (rather than failing with a NotWriteablePrimary error). Our stepdown tests skip retrying again since they think that the write finally succeeded and I could imagine that users/applications would behave similarly. If the new primary skips primary catchup (like our stepdown tests) or primary catchup times out, then it might not have the write that we assumed succeeded.

      In our test this can manifest as extra/incorrect/missing documents since the test progresses past the operation even though it did not make it onto the new primary.

            Assignee:
            matthew.russotto@mongodb.com Matthew Russotto
            Reporter:
            samy.lanka@mongodb.com Samyukta Lanka
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: