errose28 commented on code in PR #4838:
URL: https://github.com/apache/ozone/pull/4838#discussion_r1230306433


##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/TestHddsDatanodeService.java:
##########
@@ -155,20 +154,23 @@ public void testTmpDirOnShutdown(String schemaVersion) 
throws IOException {
         clusterId, conf, LOG, null);
     // Create a container and move it under the tmp delete dir.
     KeyValueContainer container = ContainerTestUtils
-        .setUpTestContainerUnderTmpDir(
+        .addContainerToDeletedDir(
             hddsVolume, clusterId, conf, schemaVersion);
     assertTrue(container.getContainerFile().exists());
     assertTrue(container.getContainerDBFile().exists());
+    File[] deletedContainersAfterShutdown =
+        hddsVolume.getDeletedContainerDir().listFiles();
+    assertNotNull(deletedContainersAfterShutdown);
+    assertEquals(1, deletedContainersAfterShutdown.length);
 
     service.stop();
     service.join();
     service.close();
 
-    ListIterator<File> deleteLeftoverIt = KeyValueContainerUtil
-        .ContainerDeleteDirectory.getDeleteLeftovers(hddsVolume);
-    assertFalse(deleteLeftoverIt.hasNext());
-
-    volumeSet.shutdown();
+    deletedContainersAfterShutdown =

Review Comment:
   `HddsVolume#shutdown` calls `HddsVolume#cleanDeletedContainerDir` to do 
clear out the directory on shutdown.
   
   `HddsDatanodeService#stop -> DatanodeStateMachine#stopDaemon -> 
DatanodeStateMachine#close -> OzoneContainer#stop -> MutableVolumeSet#shutdown 
-> StorageVolume#shutdown`. The last call is overridden if the `StorageVolume` 
is an `HddsVolume`.



-- 
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]

Reply via email to