devmadhuu commented on code in PR #4491:
URL: https://github.com/apache/ozone/pull/4491#discussion_r1166972931
##########
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:
@sadanand48 - if deleting this temp snapshot throws exception, is there a
possibility of building such temp snapshots in disk ?
##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java:
##########
@@ -1283,6 +1291,62 @@ public String createSnapshot(String pathStr, String
snapshotName)
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()));
+ }
+ OFSPath ofsPath = new OFSPath(snapshotDir, config);
+ String volume = ofsPath.getVolumeName();
+ String bucket = ofsPath.getBucketName();
+ try {
+ SnapshotDiffReportOzone aggregated;
+ SnapshotDiffReportOzone report =
+ getSnapshotDiffReportOnceComplete(fromSnapshot, toSnapshot, volume,
+ bucket, "");
+ 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, volume,
+ bucket, report.getToken());
+ aggregated.aggregate(report);
+ }
+ return aggregated;
+ } finally {
+ // delete the temp snapshot
+ if (takeTemporarySnapshot) {
+ ozoneClient.getObjectStore()
+ .deleteSnapshot(ofsPath.getVolumeName(), ofsPath.getBucketName(),
Review Comment:
Same concern here as above.
--
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]