[SERVER-31231] prevent addShard and shardCollection from running concurrently with setFCV Created: 22/Sep/17  Updated: 30/Oct/23  Resolved: 09/Oct/17

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 3.5.13
Fix Version/s: 3.6.0-rc0

Type: Task Priority: Major - P3
Reporter: Esha Maharishi (Inactive) Assignee: Esha Maharishi (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-30793 merge setFeatureCompatibilityVersion ... Closed
Backwards Compatibility: Fully Compatible
Sprint: Sharding 2017-10-23
Participants:

 Description   

addShard (that is, the _configsvrAddShard command) sends setFeatureCompatibilityVersion to the to-be-added shard, to set the shard's FCV to match the cluster's.

If addShard runs concurrently with setFCV, the added shard can end up with the wrong FCV:

1) setFCV="3.6" called against a mongos, which forwards _configsvrSetFCV to the config server
2) configsvrSetFCV finishes sending setFCV to all existing shards
3) addShard is called
--> the FCV on the config server hasn't been set to 3.6 yet, so addShard will send setFCV=3.4 to the to-be-added shard

This ticket should make the addShard command take the featureCompatibilityVersionLock ResourceMutex.

Similarly, shardCollection (that is, the _configsvrShardCollection command) asks the primary shard for the collection's UUID, if the config server's FCV is 3.6 or is being upgraded to 3.6.

If shardCollection runs concurrently with setFCV, the collection's entry in config.collections can end up without a UUID:

1) shardCollection checks FCV, sees that it is 3.4, so does not ask primary shard for a UUID
2) setFCV="3.6" called, and config server sets FCV to (3.4, 3.6) aka upgrading
3) config server generates UUIDs for existing sharded collections
4) config server sends setFCV to shards
5) config server finishes upgrade, sets FCV to 3.6
6) shardCollection persists entry without a UUID in 'config.collections' for newly sharded collection



 Comments   
Comment by Githook User [ 09/Oct/17 ]

Author:

{'email': 'esha.maharishi@mongodb.com', 'name': 'Esha Maharishi', 'username': 'EshaMaharishi'}

Message: SERVER-31231 prevent addShard and shardCollection from running concurrently with setFCV
Branch: master
https://github.com/mongodb/mongo/commit/a6db2621e6376df07f368ab4c4028843015dfa51

Generated at Thu Feb 08 04:26:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.