IFR: tassert if mutableShardServerDefaultTemplate() is accessed on mongos

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Integration
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Context

      Follow-up from review discussion on PR #58187: https://github.com/10gen/mongo/pull/58187#discussion_r3560740611

      IncrementalFeatureRolloutContext::mutableShardServerDefaultTemplate() (src/mongo/db/feature_flag.cpp) returns a static template that is only meaningful on shard servers — it's populated by initShardServerDefaultTemplate() during shard-server startup and cloned in installForRequestWithoutIfrFlags() when clusterRole.has(ClusterRole::ShardServer).

      Nothing currently prevents this accessor from being called on a mongos (router-only) process, where the template is never initialized. Such a call would silently return a default-constructed, empty IncrementalFeatureRolloutContext rather than failing loudly.

      Suggestion

      Add a tassert in mutableShardServerDefaultTemplate() (or at its call site) guarding that the current process has the shard server cluster role, so a mistaken router-side access fails fast instead of silently returning bad data.

      Reviewer (mjrb) flagged this as optional/annoying to implement, hence filing as a low-priority follow-up rather than blocking the original PR.

            Assignee:
            Charlie Swanson
            Reporter:
            Charlie Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: