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

coordinateCommitTransaction shouldn't always wait for last system opTime

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Cluster Scalability
    • Sharding NYC 2023-06-12, Sharding NYC 2023-06-26, Sharding NYC 2023-07-10, Sharding NYC 2023-07-24, Sharding NYC 2023-08-07, Sharding NYC 2023-08-21, Sharding NYC 2023-09-04, Sharding NYC 2023-09-18, Sharding NYC 2023-10-02, Sharding NYC 2023-10-16, Sharding NYC 2023-10-30, Cluster Scalability 2023-11-13, Cluster Scalability 2023-11-27, Cluster Scalability 2023-12-11, Cluster Scalability 2023-12-25, Cluster Scalability 2024-1-8, Cluster Scalability 2024-1-22, Cluster Scalability 2024-2-5, Cluster Scalability 2024-2-19, Cluster Scalability 2024-3-4, Cluster Scalability 2024-3-18, Cluster Scalability 2024-4-1, Cluster Scalability 2024-4-15, Cluster Scalability 2024-4-29, Cluster Scalability 2024-5-13
    • 3

      Currently, the coordinateCommitTransaction command sets its client opTime to the system latest to guarantee it waits for a time at least as great as the time the decision was written at. When true, the coordinateCommitReturnImmediatelyAfterPersistingDecision server parameter lets coordinateCommitTransaction return as soon as the decision is written locally, so this allows respecting a user's write concern weaker than majority. As of SERVER-63971, that parameter is false by default, so now coordinateCommitTransaction only ends after the coordinator has received decision acknowledgements from all shards. The decision is sent with majority write concern, so coordinateCommitTransaction has effectively already waited for majority write concern, but will still set its client opTime forward, and likely end up waiting for majority write concern again.

      This means in the normal case, a two phase commit transaction will wait for 5 sequential majority replications:
      1. Coordinator writing the participant list
      2. Participants applying prepareTransaction
      3. Coordinator writing the decision
      4. Participants applying the decision
      5. Coordinator waiting for system last opTime before returning from coordinateCommitTransaction

      The final wait is after the transaction has majority committed on all participants, so instead coordinateCommitTransaction should return immediately (as long as the user's write concern isn't stronger than majority). A possible fix is for the transaction coordinator to return an opTime for coordinateCommitTransaction to wait on, instead of having the command use the last system opTime.

            Assignee:
            kshitij.gupta@mongodb.com Kshitij Gupta
            Reporter:
            jack.mulrow@mongodb.com Jack Mulrow
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: