Repository navigation
[FIXED] Last msg ID is restored only if it is in duplicate window - #8564
Conversation
Signed-off-by: Daniele Sciascia <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 668b02e516
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if state.LastSeq > 0 { | ||
| if sm, err := mset.store.LoadMsg(state.LastSeq, &smv); err == nil { | ||
| mset.lmsgId = getMsgId(sm.hdr) | ||
| } |
There was a problem hiding this comment.
Persist the last ID independently of the stored message
When the last assigned sequence has no stored message—such as an InterestPolicy stream publishing with no consumers, where SkipMsgNoInterest advances the sequence while the publish path still sets mset.lmsgId—this LoadMsg fails and recovery leaves lmsgId empty. Consequently, an expected-last-ID publish that succeeds before shutdown is rejected after restart; expiration, purge, or deletion of the latest message produces the same problem. The last seen message ID needs durable state that does not depend on the corresponding message remaining loadable.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
That is a good point, but that would require a much larger change. Probably not worth it, given that the consequences are not that high, worst case we reject a conditional message that was otherwise valid.
|
@claude review |
|
Claude finished @sciascid's task in 2m 15s —— View job Code Review
SummaryThis PR fixes a real bug: after server restart, Fix Analysis (
|
On restart, the last message id was restored only if the last message was still within the duplicate window, and would otherwise be forgotten. A valid message using
Nats-Expected-Last-Msg-Idcould later be rejected.