-
Type: Bug
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.4.14, 3.6.4, 3.7.9
-
Component/s: Sharding
-
Catalog and Routing
-
ALL
-
addShard attempts to absorb any databases on a shard being added by writing them to config.databases.
It chooses the shard being added as their primary shard, then uses ShardingCatalogClient::updateDatabase() to write the database entries. Since updateDatabases() uses an update rather than an insert, it can overwrite the fields of an existing document in config.databases.
Either addShard should use an insert, or a database distlock should be held by addShard across checking if any databases conflict with the ones being added and actually adding them.