[IMPROVED] Bypass meta-layer's API queue for non-existent consumers.#6176
Merged
derekcollison merged 2 commits intomainfrom Nov 26, 2024
Merged
[IMPROVED] Bypass meta-layer's API queue for non-existent consumers.#6176derekcollison merged 2 commits intomainfrom
derekcollison merged 2 commits intomainfrom
Conversation
Add in lookup for both stream and consumer assignments at the same time. Signed-off-by: Derek Collison <derek@nats.io>
… or stream. Processing a missing consumer was a heavier operation on the meta-layer and could lead to API queue buildup. This processes that condition at point of entry to the system vs at the meta-layer. If the consumer assignment exists we do as normal for now. Signed-off-by: Derek Collison <derek@nats.io>
5f69fbf to
31cade2
Compare
neilalexander
added a commit
that referenced
this pull request
Nov 26, 2024
MauriceVanVeen
added a commit
that referenced
this pull request
Dec 13, 2024
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
MauriceVanVeen
added a commit
that referenced
this pull request
Dec 13, 2024
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
derekcollison
added a commit
that referenced
this pull request
Dec 13, 2024
…after create (#6250) Reverts #6176 and adds a test that explicitly checks for a consumer info after create using `PauseApply`. This simulates where there's agreement to create the consumer but applies are paused, so short-circuiting for a consumer info would result in a 404. Normally it would depend on how quick the applies go through the queue, but for the test just pausing and resuming applies is more reliable. Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
neilalexander
pushed a commit
that referenced
this pull request
Dec 13, 2024
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
wallyqs
pushed a commit
to wallyqs/nats-server
that referenced
this pull request
Mar 4, 2026
…posals Change jsConsumerInfoRequest to use consumerAssignmentOrInflight() instead of consumerAssignment() when looking up consumer assignments. This prevents the meta leader from returning "consumer not found" (404) when a consumer create proposal has been submitted to Raft but not yet applied. This is the same root cause that led to the revert of nats-io#6176 in nats-io#6250: when the meta leader processes an info request before a create proposal is applied, consumerAssignment() returns nil and the meta leader short-circuits with a 404. Using consumerAssignmentOrInflight() finds the inflight proposal and allows the request to proceed through the normal code path, returning partial info (config + defaults) instead. The fix is safe for inflight deletes: consumerAssignmentOrInflight() returns nil when the inflight entry has deleted=true, so info requests for consumers being deleted still correctly return 404. https://claude.ai/code/session_01Cv5a3WaLfJSU9vYsLHjUtD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Processing a missing consumer was a heavier operation on the meta-layer and could lead to API queue buildup.
This processes that condition at point of entry to the system vs at the meta-layer.
If the consumer assignment does exist we process as normal for now.
Also moved jetstream clustered state and system account to atomics to avoid lock contention.
Add in lookup for both stream and consumer assignments at the same time.
Signed-off-by: Derek Collison derek@nats.io