xiangfu0 opened a new pull request, #16423:
URL: https://github.com/apache/pinot/pull/16423

   ## Summary
   
   This PR fixes a flaky test in 
`PinotTableRestletResourceTest.testTableTasksCleanupWithNonActiveTasks` that 
was failing intermittently with the error:
   
   ```
   The table has 1 active running tasks : 
[Task_SegmentGenerationAndPushTask_...]. The task schedules have been cleared, 
so new tasks should not be generated. Please try again once there are no more 
active tasks
   ```
   
   ## Root Cause
   
   The test was experiencing a race condition where:
   1. A task was created and put into `IN_PROGRESS` state
   2. The task queue was stopped and the test waited for the task to reach 
`STOPPED` state  
   3. The task queue was resumed
   4. When attempting to delete the table, the task was still considered 
"active running" even though it was in `STOPPED` state
   
   ## Solution
   
   Added an explicit task deletion step after stopping the task:
   
   ```java
   // Explicitly delete the stopped task to ensure it's completely cleaned up
   
sendDeleteRequest(DEFAULT_INSTANCE.getControllerRequestURLBuilder().forDeleteMinionTask(taskName)
       + "?forceDelete=true");
   ```
   
   This ensures the task is completely cleaned up before attempting to delete 
the table, following the same pattern used in the 
`testTableTasksCleanupWithActiveTasks` test method.
   
   ## Testing
   
   - ✅ Ran the specific failing test method 10 times - all PASSED consistently
   - ✅ Ran the entire test class (24 tests) - all PASSED  
   - ✅ Verified no other tests were affected by the change
   
   The flakiness has been completely eliminated while maintaining the test's 
original intent to verify that non-active tasks are properly cleaned up during 
table deletion.
   
   ## Type of Change
   
   - [x] Bug fix (non-breaking change which fixes an issue)
   - [ ] New feature (non-breaking change which adds functionality)
   - [ ] Breaking change (fix or feature that would cause existing 
functionality to not work as expected)
   - [ ] Documentation update


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to