Race between stepdown and retrying write operation

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: 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
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      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
            Reporter:
            Samyukta Lanka
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: