Skip to content

fix(producer): keep partition muted during handleSuccess retries for non-idempotent producers - #3693

Open
lbcjbb wants to merge 1 commit into
IBM:mainfrom
leboncoin:fix-order-non-idempotent
Open

fix(producer): keep partition muted during handleSuccess retries for non-idempotent producers#3693
lbcjbb wants to merge 1 commit into
IBM:mainfrom
leboncoin:fix-order-non-idempotent

Conversation

@lbcjbb

@lbcjbb lbcjbb commented Jul 28, 2026

Copy link
Copy Markdown

PR #3644 changed handleError() to use retryBatch() for non-idempotent producers, keeping partitions muted during retries. However, handleSuccess() was not updated consistently: it called retryBatch() with alreadyMuted=true, but did not add the partition to keepMuted, causing the partition to be unmuted immediately after launching the retry goroutine.

This inconsistency could lead to message reordering, as a new batch for the same partition could be sent before the retry completes.

This commit aligns handleSuccess() with handleError() by:

  • Always populating keepMuted for retriable errors (not just for idempotent)
  • Always calling RefreshMetadata() before retries (not just for idempotent)

…non-idempotent producers

PR IBM#3644 changed `handleError()` to use `retryBatch()` for non-idempotent producers,
keeping partitions muted during retries. However, `handleSuccess()` was not
updated consistently: it called `retryBatch()` with `alreadyMuted=true`, but did
not add the partition to `keepMuted`, causing the partition to be unmuted
immediately after launching the retry goroutine.

This inconsistency could lead to message reordering, as a new batch for the
same partition could be sent before the retry completes.

This commit aligns `handleSuccess()` with `handleError()` by:

- Always populating `keepMuted` for retriable errors (not just for idempotent)
- Always calling `RefreshMetadata()` before retries (not just for idempotent)

Signed-off-by: Jean-Baptiste Bronisz <jean-baptiste.bronisz@adevinta.com>

@puellanivis puellanivis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don’t see any issues with the code, but I have no idea about the appropriateness of the logic here.

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