chia7712 commented on code in PR #21584:
URL: https://github.com/apache/kafka/pull/21584#discussion_r2872907002
##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/events/ApplicationEventProcessor.java:
##########
@@ -289,23 +289,32 @@ private void process(final FetchCommittedOffsetsEvent
event) {
}
/**
- * Commit all consumed if auto-commit is enabled. Note this will trigger
an async commit,
- * that will not be retried if the commit request fails.
+ * Commit all consumed if auto-commit is enabled, then update the
assignment.
+ * The event future is completed only after the commit completes, ensuring
+ * assign() blocks until offsets are durably committed.
*/
private void process(final AssignmentChangeEvent event) {
+ CompletableFuture<Void> commitFuture = null;
if (requestManagers.commitRequestManager.isPresent()) {
CommitRequestManager manager =
requestManagers.commitRequestManager.get();
- manager.updateTimerAndMaybeCommit(event.currentTimeMs());
+ commitFuture =
manager.maybeAutoCommitSyncBeforeRebalance(event.deadlineMs());
Review Comment:
`maybeAutoCommitSyncBeforeRebalance` is designed for rebalances, which
actively retries to commit offsets. For manual assignment, we should follow the
origin pattern and make a single, best-effort commit when assign is called
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]