Skip to content

GH-2576: Fix No Seeks After Error Handling #2579

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

Merged
merged 2 commits into from
Feb 14, 2023

Conversation

garyrussell
Copy link
Contributor

Resolves #2576

When the error handler seeksAfterError is false, we keep the unprocessed records in memory (retainedRecords), pause the consumer, and attempt redelivery.

If a rebalance occurs during this state, the behavior depends on whether a legacy or cooperative partition assignor is used.

With a legacy assignor, all partitions are unassigned and usually a subset is reassigned. This causes their positions to be reset to the last committed offset. In this case, all retained records must be cleared, otherwise an emergency stop occurs because records are polled when we don't expect them.

With a cooperative assignor, only a subset of the partitions are revoked. Records for these partitions must be pruned from the retainedRecords and not redelivered to the listener.

  • add code to the rebalance listener to prune the revoked paritions from the retained records
  • re-pause any assigned partitions if retained records are present

Add tests for both types of assignor.

Also tested with the reporter's reproducer.

cherry-pick to 2.9.x

Resolves spring-projects#2576

When the error handler `seeksAfterError` is false, we keep the unprocessed
records in memory (`retainedRecords`), pause the consumer, and attempt
redelivery.

If a rebalance occurs during this state, the behavior depends on whether
a legacy or cooperative partition assignor is used.

With a legacy assignor, all partitions are unassigned and usually a subset
is reassigned. This causes their positions to be reset to the last committed
offset. In this case, all retained records must be cleared, otherwise an
emergency stop occurs because records are polled when we don't expect them.

With a cooperative assignor, only a subset of the partitions are revoked.
Records for these partitions must be pruned from the `retainedRecords` and
not redelivered to the listener.

- add code to the rebalance listener to prune the revoked paritions from the retained records
- re-pause any assigned partitions if retained records are present

Add tests for both types of assignor.

Also tested with the reporter's reproducer.

**cherry-pick to 2.9.x**
Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

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

Just possible typo.

Co-authored-by: Artem Bilan <[email protected]>
@artembilan artembilan merged commit 2e2c6d6 into spring-projects:main Feb 14, 2023
@artembilan
Copy link
Member

Cherry-picked to 2.9.x as dc026c7 after fixing conflicts.

@garyrussell garyrussell deleted the GH-2576 branch February 14, 2023 20:47
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.

Non-blocking retries: partition rebalance causes emergency consumer stop
2 participants