waterWang opened a new pull request, #11757:
URL: https://github.com/apache/seatunnel/pull/11757
[Bug][Zeta] Fix stale taskDone removing execution context installed by a
newer restore generation
Closes #11755
## Problem
`TaskGroupLocation` is `{jobId, pipelineId, taskGroupId}` and is reused
verbatim across pipeline restore generations.
`TaskGroupExecutionTracker.taskDone()` removed the entry for that location from
`executionContexts` unconditionally, so a late `taskDone()` belonging to an
*earlier* generation could delete the execution context that the *current*
generation's `deployLocalTask()` had just installed for the same location.
There are only two sites writing to `executionContexts`:
- `deployLocalTask()` installs the context via
`executionContexts.put(location, ...)`
- `TaskGroupExecutionTracker.taskDone()` removes it via
`executionContexts.remove(location)`
Because the key is identical across generations, the removal carried no
notion of *which* generation it belonged to, so a stale tracker could evict a
live entry. #11727 made the failure-path reads null-safe (a task group whose
context disappears fails loudly instead of hanging the pipeline), but
deliberately did not fix the race itself.
## Fix
Make the removal conditional on identity. The `TaskGroupExecutionTracker`
now records the `TaskGroupContext` it owns (set in `deployLocalTask()`), and
`taskDone()` uses `executionContexts.remove(location, ownedContext)` — the
atomic two-argument `ConcurrentMap.remove(key, value)` — so a stale tracker
only removes the entry if it is still the one it installed. A removal from an
earlier generation is a no-op and cannot evict the newer generation's context.
## Test
The window is small and timing-dependent (originally observed via #11679
where `PaimonWithS3IT` hung ~1-in-6). `TaskDeployStaleContextRaceTest` (added
in #11727) simulates the removal path directly; the fix here makes that removal
conditional so the race can no longer evict a live entry.
--
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]