Uploaded image for project: 'Core Server'
  1. Core Server
  2. 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

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Replication
    • ALL
    • 105

      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. 

            Assignee:
            backlog-server-repl [DO NOT USE] Backlog - Replication Team
            Reporter:
            cheahuychou.mao@mongodb.com Cheahuychou Mao
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: