Skip to content

(2.14) Feature flags#7866

Open
MauriceVanVeen wants to merge 1 commit intomainfrom
maurice/feature-flags
Open

(2.14) Feature flags#7866
MauriceVanVeen wants to merge 1 commit intomainfrom
maurice/feature-flags

Conversation

@MauriceVanVeen
Copy link
Copy Markdown
Member

Add support for feature flags to change server behavior in a non-breaking way, as described in ADR-53.

Supporting the new feature_flags field:

feature_flags {
  js_ack_fc_v2: true
  ...
}

These are not needed to be used by default. The user can decide whether to opt-in or opt-out of a certain feature if needed. Normally, since no feature flags are used, this will not change anything for a given system. But if they are configured, the server will log about it on server startup:

[INF] Starting nats-server
[INF]   Version:  2.14.0-dev
[INF]   Git:      [66e9bbc]
[INF]   Name:     NBITC72CEFW5UJLESG6N7ZRT2KTGKL5N3E4SEJK7VKQSKZMEP3I364KY
[INF]   Node:     6CKYqjp8
[INF]   ID:       NBITC72CEFW5UJLESG6N7ZRT2KTGKL5N3E4SEJK7VKQSKZMEP3I364KY
[INF]   Feature flags:
[INF]     Configured:    js_ack_fc_v2 (opt-in), perf_boost (opt-out), revert_fix (disabled)
[INF]     Unsupported:   other, random

For example, this shows the user opted-in to new ack/fc JetStream consumer subjects, opted-out of some performance boost (allowing the user to report an issue while remaining on the upgraded version). Additionally, if the user configured the setting equal to the default, a value of enabled or disabled is shown depending on whether it was enabled or disabled (here the user explicitly defined to not revert a fix in the config). Unsupported fields are still logged, but doesn't prevent server startup, allowing us to add and remove feature flags freely as we see fit (but they'll of course need to be documented).

These feature flags are also included in varz, like the server_tags and server_metadata.

Related to #7860

Signed-off-by: Maurice van Veen github@mauricevanveen.com

@MauriceVanVeen MauriceVanVeen requested review from a team as code owners February 23, 2026 15:50
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
slices.Sort(value.AllowedOrigins)
case string, bool, uint8, uint16, uint64, int, int32, int64, time.Duration, float64, nil, LeafNodeOpts, ClusterOpts, *tls.Config, PinnedCertSet,
*URLAccResolver, *MemAccResolver, *DirAccResolver, *CacheDirAccResolver, Authentication, MQTTOpts, jwt.TagList,
*OCSPConfig, map[string]string, JSLimitOpts, StoreCipher, *OCSPResponseCacheConfig, *ProxiesConfig, WriteTimeoutPolicy:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config reload not supported I think right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, it can not be reloaded at the moment (it's intentional and also documented in the ADR)
But this addition was required for reload tests to still function correctly.

wallyqs pushed a commit to wallyqs/nats-server that referenced this pull request Feb 23, 2026
Implements the feature flags infrastructure and reload handler identified
as missing in the PR nats-io#7866 review. Adds FeatureFlags field to Options,
config parsing for feature_flags block, featureFlagsOption reload handler
with imposeOrder support, and a reload test covering add/modify/remove.

https://claude.ai/code/session_01CVpQg9crJ13QXa73XUcR33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants