Shekharrajak opened a new pull request, #6913:
URL: https://github.com/apache/paimon/pull/6913

   [flink] Fix unstable test: handle MiniCluster shutdown gracefully in collect 
method
   
   ### Purpose
   
   Linked issue: close #5563
   
   This PR fixes the unstable test 
`PrimaryKeyFileStoreTableITCase.testNoChangelogProducerStreamingRandom` by 
addressing a race condition in the `collect` method. The timeout thread was 
attempting to cancel jobs after the MiniCluster had already shut down, causing 
`IllegalStateException` and premature test termination. The fix follows the 
pattern used in Flink's `CollectResultFetcher` to gracefully handle shutdown 
scenarios.
   
   ### Tests
   
   - Fixed 
`PrimaryKeyFileStoreTableITCase.testNoChangelogProducerStreamingRandom` which 
was failing intermittently with:
     - `IllegalStateException: MiniCluster is not yet running or has already 
been shut down`
     - Assertion failures due to incomplete data reading caused by premature 
job cancellation
   
   The fix ensures that:
   1. When `getJobStatus()` throws an exception (e.g., MiniCluster shutdown), 
we assume the job has terminated instead of attempting cancellation
   2. Before cancelling, we check if the job is already in a terminal state
   3. All cancellation attempts are wrapped in try-catch to handle 
`IllegalStateException` gracefully
   4. Exceptions in the timeout thread no longer interfere with test execution
   
   ### API and Format
   
   No API or storage format changes.
   
   ### Documentation
   
   No documentation changes needed. This is a test stability fix.


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