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

Change server parameter to default to read-your-writes behavior after 2PC transaction

    • Fully Compatible
    • v6.0, v5.0
    • Sharding NYC 2022-05-30, Sharding NYC 2022-06-13
    • 42
    • 3

      Currently, the coordinateCommitReturnImmediatelyAfterPersistingDecision server parameter added in SERVER-37364 defaults to true, meaning a user may not get read-your-writes behavior even when using readPreference primary in the following cases:

      • User does a 2PC transaction (with a write, and within a session)
      • User tries to read the write it just did using a read
        • (1) outside a session, or
        • (2) in a different session, or
        • (3) outside a transaction in the same session without causal consistency.

      If (4) the user did the read in a new transaction in the same session (regardless of causal consistency), the read is guaranteed to return the write, because the new transaction would block until the earlier transaction had committed on the transaction participant.

      If (5) the user did the read outside a transaction in the same session but with causal consistency, I think the read would return the write, because the read's afterClusterTime would be >= the operationTime returned for the earlier transaction's commitTransaction >= the transaction's commitTimestamp >= the prepareTimestamp on any transaction participant. I think the storage engine would not allow reading a document that's in prepare at a timestamp >= the document's prepareTimestamp.

      Since we in general try to preserve read-your-writes behavior when using readPreference primary, we may want to make coordinateCommitReturnImmediatelyAfterPersistingDecision default to false. Preserving read-your-writes is also a sensible default in Serverless.

      If we make this change, we may want to improve documentation for coordinateCommitReturnImmediatelyAfterPersistingDecision for users who want to set it to true.

      CC judah.schvimer , tess.avitabile


      Acceptance criteria:

      • Change the server parameter value to false.
      • Audit what test coverage we have for coordinateCommitReturnImmediatelyAfterPersistingDecision=true to ensure we aren't losing all of our test coverage for the commitTransaction optimization. We generally aim to test the server's default behavior but having one concurrency suite running with the commitTransaction optimization on would be worthwhile.

            Assignee:
            randolph@mongodb.com Randolph Tan
            Reporter:
            esha.maharishi@mongodb.com Esha Maharishi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved: