[SERVER-55635] Make the setFCV document updates idempotent in a sharded cluster Created: 30/Mar/21  Updated: 29/Oct/23  Resolved: 27/Apr/21

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 5.0.0-rc0

Type: Task Priority: Major - P3
Reporter: Jordi Serra Torrens Assignee: Antonio Fuschetto
Resolution: Fixed Votes: 0
Labels: PM-1965-Milestone-0-Metadata-Format
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Backwards Compatibility: Fully Compatible
Sprint: Sharding 2021-04-05, Sharding EMEA 2021-05-03
Participants:
Linked BF Score: 35

 Description   

As designed in WRITING-7769, when upgrading FCV in a sharded cluster, the configsvr will invoke the setFCV command twice on shardsvrs: phase-1 and phase-2.

If a stale retry of a setFCV(phase-1) happened after a shard has already entered phase-2, the shard would be left in the temporary (upgrading/downgrading) state (it would enter phase-1 again). This wasn't an issue when FCV was a monolithic command, but since now it will consist of two different command invocations to the shards, we need to account for it.

The proposed solution is to add a 'timestamp' field to the FeatureCompatibilityVersionDocument. This field will be selected and persisted by the ConfigSvr each time a setFCV sequence starts. When the ConfigSvr invokes setFCV on the shards, it will be passed as part of the command parameters and the shards will use it to decide whether they should initiate each phase by performing a compare-and-swap write checking that the timestamp they receive is newer.



 Comments   
Comment by Githook User [ 27/Apr/21 ]

Author:

{'name': 'Antonio Fuschetto', 'email': 'antonio.fuschetto@mongodb.com', 'username': 'afuschetto'}

Message: SERVER-55635 Make the setFCV document updates idempotent in a sharded cluster
Branch: master
https://github.com/mongodb/mongo/commit/4bc9377034a98b46b19bf4ca109524e6a407cfa0

Comment by Githook User [ 23/Apr/21 ]

Author:

{'name': 'Antonio Fuschetto', 'email': 'antonio.fuschetto@mongodb.com', 'username': 'afuschetto'}

Message: SERVER-55635 Make the setFCV document updates idempotent in a sharded cluster
Branch: master
https://github.com/mongodb/mongo/commit/b95494949b10daac02ae9c0da2d492d2e3294f6e

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