1996fanrui opened a new pull request, #28997:
URL: https://github.com/apache/flink/pull/28997

   ## What is the purpose of the change
   
   `UnalignedCheckpointRescaleWithMixedExchangesITCase` is occasionally 
unstable: the
   test body passes, but teardown fails while JUnit deletes the `@TempDir` that 
also
   serves as the checkpoint directory:
   
   ```
   java.io.IOException: Failed to delete temp directory /tmp/junit-...
     Suppressed: java.nio.file.DirectoryNotEmptyException: /tmp/junit-...
   ```
   
   Root cause: the test ends each job with `jobClient.cancel().get()`. 
`cancel()` is
   asynchronous — `.get()` only signals that cancellation was *initiated*, not 
that the
   job reached a terminal state. The test then returns and JUnit deletes the 
`@TempDir`
   while the source subtasks' async snapshot of the just-completed checkpoint 
is still
   writing `SourceReaderState` into the file-merging `taskowned` directory, so 
the
   post-order delete walk hits `DirectoryNotEmptyException`. It only reproduces 
with
   file-merging enabled.
   
   ## Brief change log
   
     - `CommonTestUtils.terminateJob` now waits for the `CANCELED` terminal 
state after `cancel().get()`.
     - The UC rescale ITCases 
(`UnalignedCheckpointRescaleWithMixedExchangesITCase`, 
`UnalignedCheckpointRescaleSameUpstreamITCase`) cancel via `terminateJob` 
instead of bare `cancel().get()`.
     - `SourceTestSuiteBase` / `SinkTestSuiteBase` drop their local `killJob` 
helper (which duplicated `terminateJob` + wait-for-`CANCELED`) and call 
`terminateJob` directly.
   
   ## Verifying this change
   
   This change is a test-stability fix without new production behavior; it is 
covered by
   the existing ITCases and connector test suites. The teardown race no longer 
occurs
   because callers wait for the job to reach `CANCELED` before the 
`@TempDir`/checkpoint
   directory is deleted.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): no
     - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: no
     - The serializers: no
     - The runtime per-record code paths (performance sensitive): no
     - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
     - The S3 file system connector: no
   
   ## Documentation
   
     - Does this pull request introduce a new feature? no
     - If yes, how is the feature documented? not applicable
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code (Opus 4.8)
   


-- 
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]

Reply via email to