[SERVER-82044] Add a method for checking if a feature flag is enabled without ignoring FCV that handles the case where FCV has not been initialized Created: 10/Oct/23  Updated: 18/Oct/23  Resolved: 10/Oct/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Cheahuychou Mao Assignee: Backlog - Replication Team
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Duplicate
duplicates SERVER-79274 FCV checks can be racy if FCV is unin... Closed
Related
is related to SERVER-79330 Audit featureFlag usage in v7.0 branc... Backlog
Assigned Teams:
Replication
Operating System: ALL
Participants:
Linked BF Score: 105

 Description   

Currently, FeatureFlag::isEnabled() is the method that we use to check whether a feature flag enabled if we don't want to ignore the FCV. However, the method involves getting the FCV which would throw if the FCV is uninitialized. So right now we do the feature flag check by doing serverGlobalParams.featureCompatibility.isVersionInitialized() and then gFeatureFlagName.isEnabled(serverGlobalParams.featureCompatibility). However, it turns out initial sync has a step to reset the FCV so the FCV can become uninitialized in between the two steps, leading to an invariant failure. 

Here are all the instances of the two-step feature flag check in the 7.0 branch: 12345,  67,  8,  9,  1011,  1213,  14,  1516171819202122232425. The last two are inside NamespaceStringUtil::serialize() and deserialize() so have a high chance of hitting the race with the initial sync FCV reset. 

So the proposed solution here is to replace the two-step check with a single check handles the case where FCV is uninitialized. 


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