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

Transactions with write can be sent to the wrong shard

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 4.2.0
    • 4.2.1, 4.3.1
    • Sharding
    • None
    • Fully Compatible
    • ALL
    • v4.2
    • Sharding 2019-08-26
    • 21

    Description

      Setup:
      Collection with hashed shard keys is at version v2, updated at t10

      Steps:

      1. Stale mongos starts a transaction with write get SSV, aborts.
      2. Another migration happens, now in version v3, updated at t20.
      3. TxnRouter set with snapshot time to t10 here.
      4. Routing info gets resfreshed to v3 because it was invalidated last time.
      5. Write path gets the routing info based on t10 here
      6. Mongos targets write, correct chunk is selected here.
      7. However, when getting the shard owner of the shard, it will get the shard at t10 because of this
      8. Write request will get sent to the wrong shards, but with correct shard versions since collection routing info is up to date.
      9. We check inside the opObserver if the chunk has moved. However, since we just used the actual document key (and not the hashed value) to find the chunk, it will end up getting the wrong chunk. This will then allow it to pass the "throwIfMoved" check.

      Attachments

        Activity

          People

            randolph@mongodb.com Randolph Tan
            randolph@mongodb.com Randolph Tan
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: