Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NRG: Lockless Leaderless and HadPreviousLeader #6438

Merged
merged 2 commits into from
Jan 31, 2025
Merged

Conversation

neilalexander
Copy link
Member

This removes lock contention around JS API requests figuring out if the meta group is leaderless or not by instead tracking that state atomically.

Also fixes a race condition in inactivity thresholds/consumer pause that this seemed to uncover.

Signed-off-by: Neil Twigg [email protected]

@neilalexander neilalexander requested a review from a team as a code owner January 31, 2025 10:34
Copy link
Member

@derekcollison derekcollison left a comment

Choose a reason for hiding this comment

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

LGTM - Just question on other changes.

@@ -4436,7 +4436,11 @@ func (js *jetStream) processClusterCreateConsumer(ca *consumerAssignment, state
if isConfigUpdate = !reflect.DeepEqual(&cfg, ca.Config); isConfigUpdate {
// Call into update, ignore consumer exists error here since this means an old deliver subject is bound
// which can happen on restart etc.
if err := o.updateConfig(ca.Config); err != nil && err != NewJSConsumerNameExistError() {
// JS lock needed as this can mutate the consumer assignments and race with updateInactivityThreshold.
js.mu.Lock()
Copy link
Member

Choose a reason for hiding this comment

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

These suppose to be part of this PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

Something about the changing in the locking caused this race condition to hit far more often, to the point that it was taking several attempts of kicking CI.

I've kept it isolated in a second commit though, as that change won't be relevant for a 2.10.x backport.

@derekcollison derekcollison self-requested a review January 31, 2025 14:49
Copy link
Member

@derekcollison derekcollison left a comment

Choose a reason for hiding this comment

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

LGTM

@derekcollison derekcollison merged commit 587a4a4 into main Jan 31, 2025
5 checks passed
@derekcollison derekcollison deleted the neil/leaderless branch January 31, 2025 14:49
neilalexander added a commit that referenced this pull request Feb 6, 2025
Includes the following:

- #6406
- #6412
- #6408
- #6416
- #6425
- #6424
- #6438
- #6439
- #6446
- #6447
- #6448
- #6449
- #6450
- #6451
- #6452
- #6453
- #6456
- #6458
- #6457
- #6459
- #6460
- #6461

Signed-off-by: Neil Twigg <[email protected]>
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