peterxcli commented on code in PR #8157:
URL: https://github.com/apache/ozone/pull/8157#discussion_r2039503041


##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestOmSnapshotManager.java:
##########
@@ -113,16 +119,37 @@ void init(@TempDir File tempDir) throws Exception {
         OMConfigKeys.OZONE_OM_SNAPSHOT_CACHE_MAX_SIZE, 1);
     configuration.setBoolean(
         OMConfigKeys.OZONE_OM_SNAPSHOT_ROCKSDB_METRICS_ENABLED, false);
+    // Allow 2 fs snapshots
+    configuration.setInt(
+        OMConfigKeys.OZONE_OM_FS_SNAPSHOT_MAX_LIMIT, 2);
 
     OmTestManagers omTestManagers = new OmTestManagers(configuration);
     om = omTestManagers.getOzoneManager();
+    omMetadataManager = (OmMetadataManagerImpl) om.getMetadataManager();
+    omSnapshotManager = om.getOmSnapshotManager();
+    snapshotChainManager = omMetadataManager.getSnapshotChainManager();
   }
 
   @AfterAll
   void stop() {
     om.stop();
   }
 
+  @AfterEach
+  void cleanup() throws IOException {
+    Table<String, SnapshotInfo> snapshotInfoTable = 
omMetadataManager.getSnapshotInfoTable();

Review Comment:
   If we want to purge the snapshot through `ObjectStore#deleteSnapsot`, we 
have to set the mock `volumeTable` and `bucketTable` for each `OmSnapshot` to 
make the deleted keys scanning of `SnapshotDeletionService` work. 
   
https://github.com/apache/ozone/blob/3cb97fecdd167a99eb86193c480220bc31f15a35/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDeletingService.java#L192-L199
   
   And I had looked through the behaviours in `TestOmSnapshotManager`, it seems 
they all do direct operation on snapshotChain or the table. So I think it's ok 
to do cleanup via direct public function calling on them, and also make the 
cleanup logic explicit.



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