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

smengcl 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 33217890cc1 HDDS-17257. Intermittent failure in 
TestBlockDeletingService#testBlockDeletion (#11670)
33217890cc1 is described below

commit 33217890cc1e850086974cc883648da1627691f3
Author: KUAN-HAO HUANG <[email protected]>
AuthorDate: Thu Oct 22 20:46:45 2026 +0100

    HDDS-17257. Intermittent failure in 
TestBlockDeletingService#testBlockDeletion (#11670)
---
 .../ozone/container/common/TestBlockDeletingService.java | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git 
a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/TestBlockDeletingService.java
 
b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/TestBlockDeletingService.java
index 65573fd4852..c83a5bb37d1 100644
--- 
a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/TestBlockDeletingService.java
+++ 
b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/TestBlockDeletingService.java
@@ -110,6 +110,7 @@
 import org.apache.hadoop.ozone.container.ozoneimpl.OzoneContainer;
 import org.apache.ozone.test.GenericTestUtils;
 import org.apache.ozone.test.GenericTestUtils.LogCapturer;
+import org.apache.ozone.test.LambdaTestUtils;
 import org.apache.ozone.test.tag.Unhealthy;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Assumptions;
@@ -1351,17 +1352,18 @@ private void 
setLayoutAndSchemaForTest(ContainerTestVersionInfo versionInfo) {
   }
 
   private void assertDeletionsInChecksumFile(ContainerData data, int 
expectedNumBlocks) {
-    ContainerProtos.ContainerChecksumInfo checksumInfo = null;
+    // deleteAndWait only waits for the deleting tasks to be submitted, so the 
checksum file may not be written yet.
     try {
-      checksumInfo = readChecksumFile(data);
-    } catch (IOException ex) {
-      fail("Failed to read container checksum tree file: " + ex.getMessage());
+      LambdaTestUtils.await(3000, 100, () -> 
getNumDeletedBlocksInChecksumFile(data) >= expectedNumBlocks);
+      assertEquals(expectedNumBlocks, getNumDeletedBlocksInChecksumFile(data));
+    } catch (Exception ex) {
+      fail("Container checksum tree file did not record " + expectedNumBlocks 
+ " deleted blocks", ex);
     }
-    assertNotNull(checksumInfo);
+  }
 
-    long numDeletedBlocks = 
checksumInfo.getContainerMerkleTree().getBlockMerkleTreeList().stream()
+  private static long getNumDeletedBlocksInChecksumFile(ContainerData data) 
throws IOException {
+    return 
readChecksumFile(data).getContainerMerkleTree().getBlockMerkleTreeList().stream()
         .filter(ContainerProtos.BlockMerkleTree::getDeleted)
         .count();
-    assertEquals(expectedNumBlocks, numDeletedBlocks);
   }
 }


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

Reply via email to