This is an automated email from the ASF dual-hosted git repository.

jojochuang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 95daf18cab3 HDDS-16423. Fix intermittent failure in 
testContainerReconciliationFailureContainerScan
95daf18cab3 is described below

commit 95daf18cab3d2b5343dbd22bc62518b60ec0d2cc
Author: Siyao Meng <[email protected]>
AuthorDate: Thu Sep 24 15:18:28 2026 -0700

    HDDS-16423. Fix intermittent failure in 
testContainerReconciliationFailureContainerScan
    
    Generated-by: Claude Code (Opus 4.8)
    
    Fix intermittent failure in testContainerReconciliationFailureContainerScan 
by waiting for a prior on-demand scan to drain before asserting 
scanContainerWithoutGap schedules a Future.
    
    Fork flaky-test-check (10x10, java25): 
https://github.com/jojochuang/ozone/actions/runs/36065826987
---
 .../TestContainerReconciliationWithMockDatanodes.java | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git 
a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestContainerReconciliationWithMockDatanodes.java
 
b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestContainerReconciliationWithMockDatanodes.java
index a97a3418cc8..6c52ecb1219 100644
--- 
a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestContainerReconciliationWithMockDatanodes.java
+++ 
b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestContainerReconciliationWithMockDatanodes.java
@@ -58,6 +58,7 @@
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeoutException;
+import java.util.concurrent.atomic.AtomicReference;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
@@ -556,9 +557,21 @@ public KeyValueContainer getContainer(long containerID) {
      * Triggers a synchronous scan of the container. This method will block 
until the scan completes.
      */
     public void scanContainer(long containerID) {
-      Optional<Future<?>> scanFuture = 
onDemandScanner.scanContainerWithoutGap(containerSet.getContainer(containerID),
-          TEST_SCAN);
-      assertTrue(scanFuture.isPresent());
+      // A previously triggered on-demand scan may still be registered as in 
progress, for example the
+      // fire-and-forget scan that reconciliation schedules in a finally 
block. While it is, the scanner
+      // returns an empty Optional instead of scheduling a new one. Wait for 
the prior scan to drain so
+      // this synchronous scan is actually scheduled.
+      AtomicReference<Future<?>> scanFuture = new AtomicReference<>();
+      try {
+        GenericTestUtils.waitFor(() -> {
+          Optional<Future<?>> future =
+              
onDemandScanner.scanContainerWithoutGap(containerSet.getContainer(containerID), 
TEST_SCAN);
+          future.ifPresent(scanFuture::set);
+          return future.isPresent();
+        }, 100, 10_000);
+      } catch (InterruptedException | TimeoutException e) {
+        fail("On demand container scan was not scheduled", e);
+      }
 
       try {
         scanFuture.get().get();


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

Reply via email to