shuan1026 opened a new pull request, #11048:
URL: https://github.com/apache/ozone/pull/11048

   ## What changes were proposed in this pull request?
   
   
`TestContainerStateManagerIntegration#testGetMatchingContainerMultipleThreads` 
was tagged `@Flaky("HDDS-1159")` because it intermittently failed with 
`expected: <3> but was: <2>` (occasionally `<1>`) at the pipeline 
container-count assertion.
   
   **Root cause:** the test fires 100,000 `CompletableFuture.supplyAsync(...)` 
calls to `ContainerManager.getMatchingContainer` on a 4-thread pool, then 
immediately asserts that the pipeline already has 
`numContainerPerOwnerInPipeline` (3) containers without joining those futures. 
The loop finishing only means the tasks were submitted. When the pool has not 
yet allocated the 2nd/3rd container, the assertion fails. The existing 
`Thread.sleep(5000)` runs *after* the assertion, so it never stabilizes it.
   
   This is a test timing issue: `getMatchingContainer` already serializes 
allocation on `pipeline.getId()`. Reproduced at 2.5% (5/200) via 
`flaky-test-check` (10×20), matching the historical Jira signature.
   
   This PR waits for the work to finish before asserting:
   
   * Collect the 100k futures and `CompletableFuture.allOf(...).join()` before 
checking container count.
   * Remove the misplaced `Thread.sleep(5000)` and the unused 
`InterruptedException` on the method.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-1159
   
   ## How was this patch tested?
   
   * Full class: all 7 tests pass.
   * Pre-fix baseline: 2.5% (5/200)
     https://github.com/shuan1026/ozone/actions/runs/31984414534
   * Post-fix: 0/200 failures
     https://github.com/shuan1026/ozone/actions/runs/32152547832


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