Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-100448

Command registration should not depend on the FCV at startup

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 8.1.0-rc0, 8.0.0
    • Component/s: Upgrade/Downgrade
    • None
    • Replication
    • ALL
    • Programmability 2025-02-17
    • 200

      When commands are registered, they can be configured to require a feature flag. For example:

      MONGO_REGISTER_COMMAND(StartBlenderCmd)
          .requiresFeatureFlag(&feature_flags::gFeatureFlagBlender)
          .forShard();
      

       requiresFeatureFlag is documented as:

      A command object will be created only if the featureFlag is enabled, regardless of the current FCV.

      Thus the documented behavior is that commands are registered if the feature flag is declared in the IDL with default: true, regardless of the IDL version field and the server FCV. Before SERVER-82270, this matched the implementation.

       

      However, SERVER-82270 changed the code to instead check the feature flag using featureFlag->isEnabledUseLatestFCVWhenUninitialized(fcvSnapshot), where fcvSnapshot is the FCV at startup time. This means that command registration now depends on the FCV - and since it runs only once at startup, commands depending on FCV-gated feature flags remain not registered long after their feature flag has been enabled.

       

      On v8.0, the VoteAbortIndexBuild command, which requires an FCV-7.1-gated flag, is affected by this issue. Consider this typical upgrade sequence:

      • A cluster is running on binary 7.0 + FCV 7.0
      • The binaries are upgraded to 8.0
      • At startup, command registration runs, but since the FCV is 7.0, the VoteAbortIndexBuild command is not registered
      • The FCV is upgraded to 8.0 - note registered commands stay the same
      • Long after the upgrade is fully completed, an operation running on the fully upgraded cluster runs VoteAbortIndexBuild and unexpectedly receives a CommandNotFound error

       

      A reproducer is attached.

            Assignee:
            huayu.ouyang@mongodb.com Huayu Ouyang
            Reporter:
            joan.bruguera-mico@mongodb.com Joan Bruguera Micó
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated: