swamirishi commented on code in PR #9495:
URL: https://github.com/apache/ozone/pull/9495#discussion_r2632442437


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/SstFilteringService.java:
##########
@@ -132,6 +133,32 @@ private boolean isSnapshotDeleted(SnapshotInfo 
snapshotInfo) {
       return snapshotInfo == null || snapshotInfo.getSnapshotStatus() == 
SnapshotInfo.SnapshotStatus.SNAPSHOT_DELETED;
     }
 
+    /**
+     * Checks if the snapshot has been defragged.
+     * @param snapshotInfo snapshotInfo
+     * @return true if the snapshot has been defragged, false otherwise
+     */
+    private boolean isSnapshotDefragged(SnapshotInfo snapshotInfo) {
+      try {
+        OmSnapshotManager omSnapshotManager = 
ozoneManager.getOmSnapshotManager();
+        if (omSnapshotManager == null) {
+          return false;
+        }
+        OmSnapshotLocalDataManager localDataManager = 
omSnapshotManager.getSnapshotLocalDataManager();
+        if (localDataManager == null) {
+          return false;
+        }
+        try (OmSnapshotLocalDataManager.ReadableOmSnapshotLocalDataProvider 
provider =
+                 localDataManager.getOmSnapshotLocalData(snapshotInfo)) {
+          // If last defrag time is not 0, it means the snapshot has been 
defragged
+          return provider.getLastDefragTime() != 0;

Review Comment:
   We are not setting this lastDefragTime anywhere. We should either set this 
value or use version field and get rid of lastDefragTime altogether.



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