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

[FIXED] Make o.Update(state) consistent for file and mem & fixed int underflow #6147

Merged
merged 3 commits into from
Nov 20, 2024

Conversation

MauriceVanVeen
Copy link
Member

Made o.Update(state) consistent for file and mem stores. For example: mem would not report for certain error conditions and file would not report an error for an error condition.

Also fixed integer underflow in o.checkAckFloor.

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

Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
@MauriceVanVeen MauriceVanVeen requested a review from a team as a code owner November 19, 2024 17:04
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


// Check to see if this is an outdated update.
if state.Delivered.Consumer < o.state.Delivered.Consumer || state.AckFloor.Stream < o.state.AckFloor.Stream {
return fmt.Errorf("old update ignored")
Copy link
Member

Choose a reason for hiding this comment

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

What effect upstream does this have by changing this to an error where as before it was ignored silently?

Copy link
Member Author

Choose a reason for hiding this comment

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

A few cases where this has an effect upstream, most importantly all places already handle/bubble up any error. This is now also more consistent, since it would be done for memstore already but not for filestore before this change.

Also, setStoreState improves in that it doesn't call o.applyState(state) when the o.store.Update(state) was actually ignored/errored. Which was a bug before that would have the states drift.

	err := o.store.Update(state)
	if err == nil {
		o.applyState(state)
	}

@derekcollison derekcollison merged commit d9454d3 into main Nov 20, 2024
5 checks passed
@derekcollison derekcollison deleted the maurice/consistent-consumer-update-state branch November 20, 2024 02:50
MauriceVanVeen added a commit that referenced this pull request Nov 21, 2024
…t underflow (#6147)

Made `o.Update(state)` consistent for file and mem stores. For example:
mem would not report for certain error conditions and file would not
report an error for an error condition.

Also fixed integer underflow in `o.checkAckFloor`.

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

---------

Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
neilalexander added a commit that referenced this pull request Nov 22, 2024
Includes:

- #6147
- #6150
- #6151
- #6153
- #6154
- #6146
- #6139
- #6152
- #6157
- #6161

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