lucliu1108 opened a new pull request, #24398:
URL: https://github.com/apache/kafka/pull/24398
Under EOS vs, all active tasks on a StreamThread share one producer
transaction. When `TaskManager#handleCorruption` runs while a rebalance is in
progress, the commit of the uncorrupted tasks is skipped, and closing the
corrupted active tasks dirty then aborts the shared transaction. The healthy
tasks lose the outputs they produced since the last commit, but they keep their
in-memory input positions, so their next commit moves the input offsets past
records whose outputs were never committed. Those records are lost.
Based on the draft in #24379, `TaskManager#handleCorruption` now checks
whether the commit of the uncorrupted tasks was skipped because a rebalance is
in progress, under EOS v2 while at least one corrupted active task is about to
be closed dirty. In that case, the healthy active tasks that still have
uncommitted work are closed dirty and revived before the abort. They rewind to
their last committed offsets and reprocess the aborted records. If only standby
tasks are corrupted, the transaction is not aborted, because standby tasks have
no record collector, so the healthy tasks are left untouched.
#### Tests:
1. 3 new unit tests to `TaskManagerTest`:
-
`shouldCloseAndReviveUncommittedTasksOnCorruptedActiveTaskDuringRebalanceWithEOS`:
a restoring active task is corrupted during a rebalance while a running task
has uncommitted work. The running task is not committed, and it is closed dirty
and revived, with its input partitions marked for offset reset.
-
`shouldNotCloseAndReviveTasksThatDoNotNeedCommitOnCorruptedActiveTaskDuringRebalanceWithEOS`:
same setup, but the running task has nothing to commit. It is left untouched.
-
`shouldNotCloseAndReviveUncommittedTasksOnCorruptedStandbyTaskOnlyDuringRebalanceWithEOS`:
only a standby task is corrupted during a rebalance. The running task with
uncommitted work is not committed, closed
or reset, and no rebalance is requested.
2. New integration test, `HealthyTaskAbortOnCorruptionIntegrationTest`. It
holds a SyncGroup response and injects `OFFSET_OUT_OF_RANGE` into the restore
consumer while a healthy task keeps processing on the same thread, then checks
that every committed input record has a committed output.
--
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]