[SERVER-54171] Make `enableSharding` optimistically try to set the `sharded` bit Created: 01/Feb/21  Updated: 29/Oct/23  Resolved: 02/Feb/21

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 4.9.0-alpha4
Fix Version/s: 4.9.0

Type: Task Priority: Major - P3
Reporter: Kaloian Manassiev Assignee: Kaloian Manassiev
Resolution: Fixed Votes: 0
Labels: PM-1965-Milestone-1
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Sprint: Sharding 2021-02-08
Participants:
Linked BF Score: 23

 Description   

The enableSharding operation has a two-fold purpose: If the database doesn't exist, it creates it and also sets the sharded bit, but if the database already exists, it just sets the sharded bit. The current implementation takes the expensive createDatabase path in both cases, which in turn takes the distributed lock from the config server. However, this is problematic for the step-down suites, because it means retry of enableSharding can fail with a LockBusy error, because the lock is held by the shard.

This ticket is to make enableSharding to optimistically try to set the sharded bit first, before taking the expensive createDatabase path.



 Comments   
Comment by Githook User [ 02/Feb/21 ]

Author:

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

Message: SERVER-54171 Make `enableSharding` optimistically skip acquiring the DB DistLock
Branch: master
https://github.com/mongodb/mongo/commit/d19b65732b32761da0587dc9784366155f559e1c

Generated at Thu Feb 08 05:32:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.