Skip to content

[FIXED] Inflight meta change tracking#7798

Merged
neilalexander merged 1 commit intomainfrom
maurice/track-inflight-meta
Feb 5, 2026
Merged

[FIXED] Inflight meta change tracking#7798
neilalexander merged 1 commit intomainfrom
maurice/track-inflight-meta

Conversation

@MauriceVanVeen
Copy link
Copy Markdown
Member

This PR implements proper inflight meta changes tracking. Importantly, this fixes:

  • Concurrent stream updates would not prevent invalid state changes, like unsealing a stream.
  • Similar invalid state changes for consumers.
  • Don't let the meta leader overwrite the local consumer assignment before applying it, which could prevent an updated consumer from being included in the meta snapshot.

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

@MauriceVanVeen MauriceVanVeen requested a review from a team as a code owner February 5, 2026 12:16
Copy link
Copy Markdown
Member

@neilalexander neilalexander left a comment

Choose a reason for hiding this comment

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

Overall looks good, just a couple minor things.


// Will look up a stream assignment, either an applied or inflight assignment.
// Lock should be held.
func (js *jetStream) streamAssignmentOrInflight(account, stream string) (sa *streamAssignment) {
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.

Can we simplify this to just do early returns instead of overwriting sa? Avoids unnecessary map lookups.

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.

Done


// Will gather all stream assignments for a specific account, both applied and inflight assignments.
// Lock should be held.
func (js *jetStream) streamAssignmentOrInflightSeq(account string) iter.Seq[*streamAssignment] {
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.

Minor nit but it might make sense if this function naming is plural, since it returns more than one result. It looks a bit odd in the for loops otherwise.

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.

Done, renamed to streamAssignmentsOrInflightSeq, similarly for consumerAssignmentsOrInflightSeq.


// Will look up a consumer assignment, either an applied or inflight assignment.
// Lock should be held.
func (js *jetStream) consumerAssignmentOrInflight(account, stream, consumer string) (ca *consumerAssignment) {
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.

Same here on early returns.

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.

Done

Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
@MauriceVanVeen MauriceVanVeen force-pushed the maurice/track-inflight-meta branch from d4f5291 to cfbbd7b Compare February 5, 2026 13:49
Copy link
Copy Markdown
Member

@neilalexander neilalexander left a comment

Choose a reason for hiding this comment

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

LGTM!

@neilalexander neilalexander merged commit 6481733 into main Feb 5, 2026
48 checks passed
@neilalexander neilalexander deleted the maurice/track-inflight-meta branch February 5, 2026 14:08
neilalexander added a commit that referenced this pull request Feb 16, 2026
Includes the following:

- #7780
- #7784
- #7782
- #7783
- #7787
- #7789
- #7793
- #7797
- #7798
- #7799
- #7790
- #7805
- #7810
- #7811
- #7812
- #7809
- #7724
- #7815
- #7816
- #7818
- #7819
- #7820
- #7795
- #7825
- #7828
- #7835
- #7837

Signed-off-by: Neil Twigg <neil@nats.io>
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.

2 participants