This is an automated email from the ASF dual-hosted git repository.
adoroszlai 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 09d3b2757d HDDS-13244. TestSnapshotDeletingServiceIntegrationTest
should close snapshots after deleting them (#8611)
09d3b2757d is described below
commit 09d3b2757d63d3776a6ff437cdc0b97dc2c5e95b
Author: Swaminathan Balachandran <[email protected]>
AuthorDate: Thu Jun 12 12:53:28 2025 -0400
HDDS-13244. TestSnapshotDeletingServiceIntegrationTest should close
snapshots after deleting them (#8611)
---
...TestSnapshotDeletingServiceIntegrationTest.java | 41 ++++++++++++++--------
1 file changed, 27 insertions(+), 14 deletions(-)
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestSnapshotDeletingServiceIntegrationTest.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestSnapshotDeletingServiceIntegrationTest.java
index 02c13145b0..48d1c2f978 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestSnapshotDeletingServiceIntegrationTest.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestSnapshotDeletingServiceIntegrationTest.java
@@ -34,7 +34,9 @@
import java.io.IOException;
import java.nio.ByteBuffer;
+import java.util.ArrayDeque;
import java.util.Collections;
+import java.util.Deque;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -79,9 +81,9 @@
import org.apache.hadoop.ozone.om.service.SnapshotDeletingService;
import org.apache.ozone.test.GenericTestUtils;
import org.apache.ozone.test.tag.Flaky;
-import org.apache.ozone.test.tag.Unhealthy;
import org.apache.ratis.util.function.UncheckedAutoCloseableSupplier;
import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
@@ -99,7 +101,6 @@
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@TestMethodOrder(OrderAnnotation.class)
-@Unhealthy("HDDS-13244")
public class TestSnapshotDeletingServiceIntegrationTest {
private static final Logger LOG =
@@ -111,6 +112,7 @@ public class TestSnapshotDeletingServiceIntegrationTest {
private OzoneManager om;
private OzoneBucket bucket1;
private OzoneClient client;
+ private final Deque<UncheckedAutoCloseableSupplier<OmSnapshot>> rcSnaps =
new ArrayDeque<>();
private static final String VOLUME_NAME = "vol1";
private static final String BUCKET_NAME_ONE = "bucket1";
private static final String BUCKET_NAME_TWO = "bucket2";
@@ -154,6 +156,19 @@ public void teardown() {
}
}
+ @AfterEach
+ public void closeAllSnapshots() {
+ while (!rcSnaps.isEmpty()) {
+ rcSnaps.pop().close();
+ }
+ }
+
+ private UncheckedAutoCloseableSupplier<OmSnapshot> getOmSnapshot(String
volume, String bucket, String snapshotName)
+ throws IOException {
+ rcSnaps.push(om.getOmSnapshotManager().getSnapshot(volume, bucket,
snapshotName));
+ return rcSnaps.peek();
+ }
+
@Test
@Order(2)
@Flaky("HDDS-11130")
@@ -171,8 +186,7 @@ public void testSnapshotSplitAndMove() throws Exception {
GenericTestUtils.waitFor(() -> snapshotDeletingService
.getSuccessfulRunCount() >= 1, 1000, 10000);
}
- OmSnapshot bucket1snap3 = om.getOmSnapshotManager()
- .getSnapshot(VOLUME_NAME, BUCKET_NAME_ONE, "bucket1snap3").get();
+ OmSnapshot bucket1snap3 = getOmSnapshot(VOLUME_NAME, BUCKET_NAME_ONE,
"bucket1snap3").get();
// Check bucket1key1 added to next non deleted snapshot db.
List<? extends Table.KeyValue<String, RepeatedOmKeyInfo>> omKeyInfos =
@@ -403,9 +417,9 @@ public void testSnapshotWithFSO() throws Exception {
}
om.getKeyManager().getDirDeletingService().suspend();
om.getKeyManager().getDeletingService().suspend();
-
- OmSnapshot snap2 = om.getOmSnapshotManager()
- .getSnapshot(VOLUME_NAME, BUCKET_NAME_FSO, "snap2").get();
+ UncheckedAutoCloseableSupplier<OmSnapshot> rcSnap2 =
+ getOmSnapshot(VOLUME_NAME, BUCKET_NAME_FSO, "snap2");
+ OmSnapshot snap2 = rcSnap2.get();
//Child directories should have moved to deleted Directory table to
deleted directory table of snap2
assertTableRowCount(dirTable, 0);
assertTableRowCount(keyTable, 11);
@@ -414,7 +428,7 @@ public void testSnapshotWithFSO() throws Exception {
client.getObjectStore().deleteSnapshot(VOLUME_NAME, BUCKET_NAME_FSO,
"snap2");
-
+ rcSnap2.close();
assertTableRowCount(snapshotInfoTable, 2);
@@ -428,8 +442,8 @@ public void testSnapshotWithFSO() throws Exception {
assertTableRowCount(om.getMetadataManager().getSnapshotInfoTable(), 2);
verifySnapshotChain(deletedSnap, "/vol1/bucketfso/snap3");
- OmSnapshot snap3 = om.getOmSnapshotManager()
- .getSnapshot(VOLUME_NAME, BUCKET_NAME_FSO, "snap3").get();
+ UncheckedAutoCloseableSupplier<OmSnapshot> rcSnap3 =
getOmSnapshot(VOLUME_NAME, BUCKET_NAME_FSO, "snap3");
+ OmSnapshot snap3 = rcSnap3.get();
Table<String, OmKeyInfo> snapDeletedDirTable =
snap3.getMetadataManager().getDeletedDirTable();
@@ -471,6 +485,8 @@ public void testSnapshotWithFSO() throws Exception {
// Delete Snapshot3 and check entries moved to active DB
client.getObjectStore().deleteSnapshot(VOLUME_NAME, BUCKET_NAME_FSO,
"snap3");
+ rcSnap3.close();
+
om.getKeyManager().getDirDeletingService().resume();
om.getKeyManager().getDeletingService().resume();
// Check entries moved to active DB
@@ -479,9 +495,7 @@ public void testSnapshotWithFSO() throws Exception {
assertTableRowCount(deletedDirTable, 12);
assertTableRowCount(deletedTable, 15);
- UncheckedAutoCloseableSupplier<OmSnapshot> rcSnap1 =
- om.getOmSnapshotManager().getSnapshot(
- VOLUME_NAME, BUCKET_NAME_FSO, "snap1");
+ UncheckedAutoCloseableSupplier<OmSnapshot> rcSnap1 =
getOmSnapshot(VOLUME_NAME, BUCKET_NAME_FSO, "snap1");
OmSnapshot snap1 = rcSnap1.get();
Table<String, OmKeyInfo> snap1KeyTable =
snap1.getMetadataManager().getFileTable();
@@ -516,7 +530,6 @@ public void testSnapshotWithFSO() throws Exception {
assertTableRowCount(deletedTable, 15);
snap1 = null;
- rcSnap1.close();
}
private DirectoryDeletingService
getMockedDirectoryDeletingService(AtomicBoolean dirDeletionWaitStarted,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]