[SERVER-84723] Sharded multi-document transactions can observe partial effects of concurrent DDL operations Created: 10/Jan/24  Updated: 01/Feb/24  Resolved: 31/Jan/24

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 7.0.0
Fix Version/s: 8.0.0-rc0

Type: Bug Priority: Critical - P2
Reporter: Jordi Serra Torrens Assignee: Jordi Serra Torrens
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File repro.js     File repro2.js    
Issue Links:
Backports
Depends
Problem/Incident
Related
related to SERVER-77506 Sharded multi-document transactions c... Closed
is related to SERVER-84760 Violation of transaction snapshot iso... In Code Review
Assigned Teams:
Catalog and Routing
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v7.0
Sprint: CAR Team 2024-01-22, CAR Team 2024-02-05
Participants:

 Description   

Consider the following interleaving (repro1.js):
1. Initial state:

  • collA: sharded collection with chunks both on shard0 and shard1.
  • collB: unsharded collection on shard0.
  • collC: does not exist.

2. Start txn with local or majority read concern, hit shard0 to read collB [shard0's txn snapshot has: ns1 and ns2]
3. Rename collA -> collC.
4. Read collC. On shard0, collC does not exist in the txn snapshot. On shard1 it will. Therefore the txn will see half the collection.

Moreover, if collectionC existed initially, the transaction would observe a mix of the original collection and the post-rename collection.
The example above involves rename, but a similar situation might be possible with reshardCollection.

Another anomaly is (repro2.js):
1. Initial state

  • shard0 (dbPrimary): collA(sharded) and collB(unsharded)
  • shard1: collA(sharded)

2. Start txn (local, majority or snapshot read concern), hit shard0 for collB
3. Drop collA
4. Read collA. Will target shard0, will read the sharded coll (but just half of it).



 Comments   
Comment by Githook User [ 31/Jan/24 ]

Author:

{'name': 'Jordi Serra Torrens', 'email': 'jordist@users.noreply.github.com', 'username': 'jordist'}

Message: SERVER-84723 Ensure sharding catalog is valid when acquiring collections in multi-document transactions (#18193)

GitOrigin-RevId: 3a7b1e4f29dfae062ad1ef904280a1e40d0a411c
Branch: master
https://github.com/mongodb/mongo/commit/03be106d1749971acc549bfc827e3d59da57f526

Generated at Thu Feb 08 06:55:49 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.