sadanand48 commented on code in PR #9079:
URL: https://github.com/apache/ozone/pull/9079#discussion_r2413900470
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/SnapshotDiffManager.java:
##########
@@ -1180,6 +1199,37 @@ Set<String> getDeltaFiles(OmSnapshot fromSnapshot,
// TODO: [SNAPSHOT] Refactor the parameter list
Optional<Set<String>> deltaFiles = Optional.empty();
+ OmSnapshotLocalData fromSnapshotLocalData = getSnapshotLocalData(fsInfo);
+ int fromSnapshotVersion = fromSnapshotLocalData.getVersion();
+ OmSnapshotLocalData toSnapshotLocalData = getSnapshotLocalData(tsInfo);
+ int toSnapshotVersion = toSnapshotLocalData.getVersion();
+
+ try {
+ if (fromSnapshotVersion > 0 && toSnapshotVersion > 0) {
+ // both snapshots are defragmented, To calculate snap-diff, we can
simply compare the
+ // SST files contained in OmSnapshotLocalData instances of both these
and get the delta files
+ OmSnapshotLocalData.VersionMeta toSnapVersionMeta =
+
toSnapshotLocalData.getVersionSstFileInfos().get(toSnapshotVersion);
+ // get the source snapshot SST files (versionMeta) corresponding to
target snapshot
+ OmSnapshotLocalData.VersionMeta fromSnapVersionMeta =
+ resolveBaseVersionMeta(toSnapshotLocalData,
fromSnapshot.getSnapshotID());
+ // Calculate diff files using helper method
+ if (toSnapVersionMeta == null) {
+ String errMsg =
+ "Cannot find corresponding version of from snapshot " +
fromSnapshotVersion + " from " + tsInfo;
+ LOG.error(errMsg);
+ throw new IOException(errMsg);
+ }
+ List<String> diffFiles = calculateDiffFiles(fromSnapVersionMeta,
toSnapVersionMeta);
+ return OmSnapshotUtils.getSSTDiffListWithFullPath(diffFiles,
+
OmSnapshotManager.getSnapshotPath(ozoneManager.getMetadataManager(),
fsInfo).toString(),
+
OmSnapshotManager.getSnapshotPath(ozoneManager.getMetadataManager(),
tsInfo).toString(), diffDir);
+ }
+ } catch (Exception e) {
+ LOG.error("Failed to calculate snap-diff between fromSnapshot : {} ,
toSnapshot: {} via optimal method," +
+ "Falling back to other methods", fsInfo, tsInfo, e);
+ }
+
// Check if compaction DAG is available, use that if so
if (differ != null && fsInfo != null && tsInfo != null && !useFullDiff) {
Review Comment:
do we need to change DAG based diff code ? I think it already works on
version=0 files. If first if statement fails , this is the exact flow we have
today too. First DAG based diff is tried, if it fails it fallsback to full diff
--
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]