[SERVER-64822] Sharding an empty collection releases the critical section too early Created: 23/Mar/22  Updated: 29/Oct/23  Resolved: 07/Apr/22

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 5.0.5, 5.1.1, 5.2.1, 5.3.0-rc4
Fix Version/s: 6.0.0-rc0, 5.0.9

Type: Bug Priority: Major - P3
Reporter: Kaloian Manassiev Assignee: Kaloian Manassiev
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v5.0
Sprint: Sharding EMEA 2022-04-04, Sharding EMEA 2022-04-18
Participants:

 Description   

When we shard an empty collection we can take a shortcut and create chunks on shards different from the DB primary. This needs to happen under the critical section so that we don't accept writes to the empty collection, before we have actually told the DB primary to no longer accept unsharded writes.

The bug that we have is that we release the critical section after we have made the newly sharded collection visible, but before we set the shard version on the DB primary for that collection.

This means that there is a brief window during which writes for an empty collection that was just sharded could be accepted.



 Comments   
Comment by Githook User [ 24/Apr/22 ]

Author:

{'name': 'Kaloian Manassiev', 'email': 'kaloian.manassiev@mongodb.com', 'username': 'kaloianm'}

Message: SERVER-64822 Clear filtering metadata if createCollection commit fails

(cherry picked from commit c257704b483fb3938465f5eb4f2a01e1d1e7c119)
Branch: v5.0
https://github.com/mongodb/mongo/commit/f03ce604556625b9b64d04ceca8f18d28b67733a

Comment by Githook User [ 07/Apr/22 ]

Author:

{'name': 'Kaloian Manassiev', 'email': 'kaloian.manassiev@mongodb.com', 'username': 'kaloianm'}

Message: SERVER-64822 Clear filtering metadata if createCollection commit fails
Branch: master
https://github.com/mongodb/mongo/commit/c257704b483fb3938465f5eb4f2a01e1d1e7c119

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