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

Sharded multi-document transactions can mismatch data and ShardVersion

    • Fully Compatible
    • ALL
    • v7.1, v7.0, v6.0, v5.0, v4.4
    • Show
      repro.patch
    • Sharding EMEA 2023-06-12, Sharding EMEA 2023-06-26, Sharding EMEA 2023-07-10, Sharding EMEA 2023-07-24
    • 135
    • 2

      The second and following statements of a multi-document transaction can operate on an already opened storage engine snapshot whose data doesn't match the ShardVersion indicated by the router.

      e.g:

      Consider a sharded multi-document transactions with read concern 'local' or 'majority'. The first statement targets collectionA which exists on shard0. This opens a storage engine snapshot on shard0 at T100. 

      At T100, shard0 owned half the range of collectionB. Later, a chunk migration happens and shard0 becomes owner of the whole range and its ShardVersion is SV2.

      A second statement of the transaction will target collectionB. The router routes according to the post-migration placement (that shard0 owns the whole range) thus it will only target shard0 with SV2.

      The shard will check the SV and see that it matches. However, the storage snapshot at which the transaction is operating does not include the documents for the newly received chunk. So the query will miss documents.

            Assignee:
            randolph@mongodb.com Randolph Tan
            Reporter:
            jordi.serra-torrens@mongodb.com Jordi Serra Torrens
            Votes:
            0 Vote for this issue
            Watchers:
            46 Start watching this issue

              Created:
              Updated:
              Resolved: