Setup:
Collection with hashed shard keys is at version v2, updated at t10
Steps:
- Stale mongos starts a transaction with write get SSV, aborts.
- Another migration happens, now in version v3, updated at t20.
- TxnRouter set with snapshot time to t10 here.
- Routing info gets resfreshed to v3 because it was invalidated last time.
- Write path gets the routing info based on t10 here
- Mongos targets write, correct chunk is selected here.
- However, when getting the shard owner of the shard, it will get the shard at t10 because of this
- Write request will get sent to the wrong shards, but with correct shard versions since collection routing info is up to date.
- 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.