sadanand48 commented on code in PR #4491:
URL: https://github.com/apache/ozone/pull/4491#discussion_r1168779934


##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java:
##########
@@ -646,4 +653,56 @@ public String createSnapshot(String pathStr, String 
snapshotName)
         ofsPath.getBucketName(),
         snapshotName);
   }
+
+  @Override
+  public SnapshotDiffReport getSnapshotDiffReport(Path snapshotDir,
+      String fromSnapshot, String toSnapshot)
+      throws IOException, InterruptedException {
+    boolean takeTemporarySnapshot = false;
+    if (toSnapshot.equals(ACTIVE_FS_SNAPSHOT_NAME)) {
+      takeTemporarySnapshot = true;
+      toSnapshot = createSnapshot(snapshotDir.toString(),
+          "temp" + SnapshotInfo.generateName(Time.now()));
+    }
+    try {
+      SnapshotDiffReportOzone aggregated;
+      SnapshotDiffReportOzone report =
+          getSnapshotDiffReportOnceComplete(fromSnapshot, toSnapshot, "");
+      aggregated = report;
+      while (!report.getToken().isEmpty()) {
+        LOG.info(
+            "Total Snapshot Diff length between snapshot {} and {} exceeds"
+                + " max page size, Performing another " +
+                "snapdiff with index at {}",
+            fromSnapshot, toSnapshot, report.getToken());
+        report = getSnapshotDiffReportOnceComplete(fromSnapshot, toSnapshot,
+            report.getToken());
+        aggregated.aggregate(report);
+      }
+      return aggregated;
+    } finally {
+      // delete the temp snapshot
+      if (takeTemporarySnapshot) {
+        OFSPath snapPath = new OFSPath(snapshotDir.toString(), config);
+        ozoneClient.getObjectStore()
+            .deleteSnapshot(snapPath.getVolumeName(), snapPath.getBucketName(),

Review Comment:
   Yes thats a good point, there is a snapshot deleting task that cares care of 
cleaning up the deleted snapshots, we could add handling there to delete these 
type of snapshots if present. I will create a separate jira for this.
   cc @smengcl 



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