(2.14) [FIXED] AckAll on WQ removed messages outside consumer filter - #8431
Conversation
|
Claude finished @MauriceVanVeen's task in 5m 46s —— View job Code Review
The fix is correct. Both paths have been properly updated to restrict
The pivot to collecting candidates via One minor note:
The store-based traversal for the filtered case is correct. The loop advances One invariant worth noting for future readers: the
Test coverage is thorough:
Both tests validate R1 and R3 paths, covering both the non-clustered ( No issues found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f15d723e76
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
f15d723 to
4eca230
Compare
|
@claude, brief re-review. |
|
Claude finished @MauriceVanVeen's task in 1m 38s —— View job Re-review
The fix looks correct. Here's a focused assessment of each path and the Codex concern.
The new code collects from Re: Codex's filter-update concern The concern was that the clustered path used current consumer filters rather than the pre-ack pending state. This does not apply to the current code. The PR does not use filters in the clustered path at all — it uses One invariant worth noting: No issues found. The two paths are now properly symmetric and correct. |
| ackInPlace := o.node == nil && o.retention != LimitsPolicy && needLock | ||
|
|
||
| var sgap, floor uint64 | ||
| var ackAllSeqs []uint64 |
There was a problem hiding this comment.
Do we have a sense of how big this array can get?
There was a problem hiding this comment.
At most MaxAckPending
There was a problem hiding this comment.
Since the default is 1000, we could potentially preallocate on the stack, should reduce the number of reallocations and heap escapes:
var _ackAllSeqs [1000]uint64
ackAllSeqs := _ackAllSeqs[:0]
There was a problem hiding this comment.
Discussed to instead use ackAllSeqs = make([]uint64, 0, min(uint64(len(o.pending)), sgap-1)). To only allocate for AckAll/AckFlowControl policy, and not for the normal paths.
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
4eca230 to
74d7a2d
Compare
|
@claude, brief re-review. |
|
Claude finished @MauriceVanVeen's task in 1m 24s —— View job Re-review
The one material change since the prior re-review is the allocation strategy for
ackAllSeqs = make([]uint64, 0, min(uint64(len(o.pending)), sgap-1))This is the right approach. The capacity is
The The allocation only happens on the AckAll/AckFlowControl path, so AckExplicit consumers pay zero cost. This is better than the fixed 1000-element stack array neilalexander suggested, which would allocate 8 KB on every
Same pattern: ackAllSeqs = make([]uint64, 0, min(uint64(len(state.Pending)), sagap-1))Here the Both paths are now symmetric in structure and allocation strategy. No issues found. |
|
Hi, @MauriceVanVeen @neilalexander I initially assumed that #8431 was included because it is referenced in #8450. Looking at the v2.14.6-RC.1 source, the AckAll handling also still appears to Could you please confirm:
|
|
We will be picking in this PR into 2.14.6 now that #8528 is merged too. |
Normally
AckAllon a WorkQueue isn't permitted, sinceAckExplicitorAckFlowControlis required. However, if you'd source from a WorkQueue starting from 2.14, this uses a consumer withAckFlowControl, which functions likeAckAll. A filtered source consumer could then ack messages outside the consumer filter, resulting in those messages being removed. This path also is engaged for Interest streams, but isn't problematic there since messages without a consumer have no interest, so removing them is correct.This PR fixes that by only calling
mset.ackMsgon messages that were pending prior to theAckAll.Resolves #8423