-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Conversation
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>
There was a problem hiding this 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") |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)
}
…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>
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