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

Skip read only shard commit phase for two phase writes

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Cluster Scalability
    • 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

      The two phase write protocol for single writes without a shard key match do a broadcast read and then write to a single shard with a matching document. SERVER-48340 restores the single write shard commit optimization, which lets two phase writes skip two phase commit, since they will always write to at most one shard.

      The single write shard optimization has two phases: a round of commits on the read only shards, then if all read only commits were successful, sending commit to the one write shard. Two phase writes can be further optimized to skip the first commit phase because single writes don't care if read only shards not chosen to perform the write are able to commit. To satisfy the guarantees of a single write (ie only one matching document is updated), it's enough to only commit on the chosen write shard. Thus commit can become a single phase - committing on the write shard and in parallel committing (or aborting since it's cheaper) on the read shards (so they release their resources, their responses can be ignored).

        1. SERVER-78407-POC.diff
          9 kB
          Jack Mulrow

            Assignee:
            jack.mulrow@mongodb.com Jack Mulrow
            Reporter:
            jack.mulrow@mongodb.com Jack Mulrow
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: