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 a82f5624b7b HDDS-13880. Fix flaky 
TestKeyDeletingService#testSnapshotDeepClean (#11485)
a82f5624b7b is described below

commit a82f5624b7ba3ec29fac1e8c42baef55c1501d62
Author: Mark Tsai <[email protected]>
AuthorDate: Mon Oct 12 23:49:14 2026 +0800

    HDDS-13880. Fix flaky TestKeyDeletingService#testSnapshotDeepClean (#11485)
---
 .../ozone/om/service/TestKeyDeletingService.java   | 24 +++++++++++++---------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git 
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestKeyDeletingService.java
 
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestKeyDeletingService.java
index 533a4a1daff..d3c7001ec17 100644
--- 
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestKeyDeletingService.java
+++ 
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestKeyDeletingService.java
@@ -120,7 +120,6 @@
 import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos;
 import org.apache.ozone.test.GenericTestUtils;
 import org.apache.ozone.test.OzoneTestBase;
-import org.apache.ozone.test.tag.Flaky;
 import org.apache.ratis.protocol.ClientId;
 import org.apache.ratis.util.ExitUtils;
 import org.apache.ratis.util.function.UncheckedAutoCloseableSupplier;
@@ -659,7 +658,6 @@ public void testRenamedKeyReclaimation(boolean 
testForSnapshot)
        of Snap3 should be empty.
      */
     @Test
-    @Flaky("HDDS-13880")
     void testSnapshotDeepClean() throws Exception {
       Table<String, SnapshotInfo> snapshotInfoTable =
           om.getMetadataManager().getSnapshotInfoTable();
@@ -721,23 +719,29 @@ void testSnapshotDeepClean() throws Exception {
       keyDeletingService.resume();
       directoryDeletingService.resume();
 
+      // Hold the snap3 DB handle only while its tables are read: the handle 
keeps a snapshot DB read lock, and the
+      // OMDoubleBuffer flush thread needs a colliding write lock on the same 
stripe to purge snap2 below.
       try (UncheckedAutoCloseableSupplier<OmSnapshot> rcOmSnapshot =
                om.getOmSnapshotManager().getSnapshot(volumeName, bucketName, 
snap3)) {
-        OmSnapshot snapshot3 = rcOmSnapshot.get();
-
         Table<String, RepeatedOmKeyInfo> snap3deletedTable =
-            snapshot3.getMetadataManager().getDeletedTable();
-
+            rcOmSnapshot.get().getMetadataManager().getDeletedTable();
         // 5 keys can be deep cleaned as it was stuck previously
         assertTableRowCount(snap3deletedTable, initialDeletedCount + 10, 
metadataManager);
+      }
 
-        writeClient.deleteSnapshot(volumeName, bucketName, snap2);
-        assertTableRowCount(snapshotInfoTable, initialSnapshotCount + 2, 
metadataManager);
+      writeClient.deleteSnapshot(volumeName, bucketName, snap2);
+      assertTableRowCount(snapshotInfoTable, initialSnapshotCount + 2, 
metadataManager);
 
+      // Re-fetch the deleted table: SnapshotCache may have closed and 
reloaded snap3 while no handle was held.
+      try (UncheckedAutoCloseableSupplier<OmSnapshot> rcOmSnapshot =
+               om.getOmSnapshotManager().getSnapshot(volumeName, bucketName, 
snap3)) {
+        Table<String, RepeatedOmKeyInfo> snap3deletedTable =
+            rcOmSnapshot.get().getMetadataManager().getDeletedTable();
         assertTableRowCount(snap3deletedTable, initialDeletedCount, 
metadataManager);
-        assertTableRowCount(deletedTable, initialDeletedCount, 
metadataManager);
-        checkSnapDeepCleanStatus(snapshotInfoTable, volumeName, true);
       }
+
+      assertTableRowCount(deletedTable, initialDeletedCount, metadataManager);
+      checkSnapDeepCleanStatus(snapshotInfoTable, volumeName, true);
       sstFilteringService.resume();
     }
 


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

Reply via email to