Copilot commented on code in PR #10987:
URL: https://github.com/apache/ozone/pull/10987#discussion_r3753648524
##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestKeyDeletingService.java:
##########
@@ -849,6 +850,91 @@ void testSnapshotExclusiveSize() throws Exception {
}
}
+ @Nested
+ @TestInstance(TestInstance.Lifecycle.PER_CLASS)
+ class SnapshotDbHandleLifecycle {
+
+ @BeforeAll
+ void setup(@TempDir File testDir) throws Exception {
+ scmBlockTestingClient = new ScmBlockLocationTestingClient(null, null, 0);
+ createConfig(testDir);
+ createSubject();
+ keyDeletingService.shutdown();
+ }
+
+ @AfterAll
+ void cleanup() {
+ if (om.stop()) {
+ om.join();
+ }
+ }
+
+ @Test
+ @DisplayName("KeyDeletingService should close the snapshot DB handle
before submitting an OM request")
+ void testSnapshotDbHandleClosedBeforeSubmit() throws Exception {
+ String volumeName = getTestName();
+ String bucketName = uniqueObjectName("bucket");
+ String snapshotName = uniqueObjectName("snap");
+ createVolumeAndBucket(volumeName, bucketName, false);
+ writeClient.createSnapshot(volumeName, bucketName, snapshotName);
+ om.awaitDoubleBufferFlush();
+
+ String snapshotKey = SnapshotInfo.getTableKey(volumeName, bucketName,
snapshotName);
+ SnapshotInfo snapshotInfo =
metadataManager.getSnapshotInfoTable().get(snapshotKey);
+ GenericTestUtils.waitFor(() -> {
+ try {
+ return
OmSnapshotManager.areSnapshotChangesFlushedToDB(metadataManager, snapshotInfo);
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }, 100, 10000);
+ snapshotInfo.setDeepCleanedDeletedDir(true);
Review Comment:
The test sets `deepCleanedDeletedDir` on a `SnapshotInfo` instance but does
not persist it back to the `snapshotInfoTable` cache/DB.
`KeyDeletingTask.call()` reloads `SnapshotInfo` via
`SnapshotUtils.getSnapshotInfo(...)` and may still see
`deepCleanedDeletedDir=false`, causing the task to return early and never
submit a request (flaky/non-deterministic depending on table caching behavior).
--
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]