Details
-
Task
-
Resolution: Fixed
-
Major - P3
-
4.9.0-alpha4
-
Fully Compatible
-
Sharding 2021-02-08
-
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.