Repository navigation
[fix][broker] Defer ack state updates until persistence succeeds - #25528
Conversation
|
Will the broker stop dispatch messages to the consumer if the consumer has been set to a lower max unack message and the persistence interval of the cursor set to a higher value? |
|
The broker should not stop dispatching messages just because In this implementation, For the normal path, the ack immediately triggers async mark-delete/delete persistence, so it does not wait for
|
b6b33f1 to
65f7a2a
Compare
872e835 to
509d095
Compare
509d095 to
b27a7ae
Compare
dao-jun
left a comment
There was a problem hiding this comment.
LGTM, but need more eyes on it.
@nodece Is there a follow-up PR for this known limitation? |
|
@lhotari No. I will make an issue to track this known limitation. |
Re-apply the change on top of master and extend it to the paths added since: the pending-ack store, commit/abort mark and cursor ack callbacks now hop back to internalPinnedExecutor before touching individualAckOfTransaction or cumulativeAckOfTransaction. In particular, the removal of a committed transaction after the cursor ack (apache#25528) ran on the cursor's thread without the lock, racing with other transactions' updates of the non-thread-safe LinkedMap.
…ache#22166) Co-authored-by: Matteo Merli <[email protected]> (cherry picked from commit 01b0c0a) (branch-4.2: the cursor ack is synchronous here (no apache#25528), so individualAckCommitCommon and the cumulative commit keep the synchronous acknowledgeMessage; the cursor-thread commit test was dropped.)
…ache#22166) Co-authored-by: Matteo Merli <[email protected]> (cherry picked from commit 01b0c0a) (branch-4.2: the cursor ack is synchronous here (no apache#25528), so individualAckCommitCommon and the cumulative commit keep the synchronous acknowledgeMessage; the cursor-thread commit test was dropped.)
Motivation
The broker ack path was updating consumer-side in-memory ack state before the underlying subscription ack path had fully completed. That makes ack failures harder to reason about and can leave broker-side state transitions out of sync with the persisted ack result and ack-receipt flow.
Changes
ServerCnxConsumer.individualAckNormalandConsumer.individualAckWithTransactioninto a single unifiedindividualAckmethod, eliminating code duplication between the transactional and non-transactional individual ack paths. The unified method preserves the original timing semantics:computeAckedCountto return the correct batch size (instead of always1) when no batch-index ack set is present, ensuringmessageAckRatemetrics are accurate for batched messages