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


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/SnapshotDiffManager.java:
##########
@@ -1223,6 +1273,81 @@ Set<String> getDeltaFiles(OmSnapshot fromSnapshot,
             toSnapshot.getSnapshotTableKey()));
   }
 
+  /**
+   * Resolve the VersionMeta of the ancestor snapshot (fromSnapshotId)
+   * that the given snapshot (toSnapshot) was built on.
+   * Traverses the snapshot chain backwards using prevSnapId.
+   *
+   * @param toSnapshot the target snapshot.
+   * @param fromSnapshotId UUID of the source snapshot.
+   * @return the resolved VersionMeta of the source that was used to build the 
target.
+   */
+  private OmSnapshotLocalData.VersionMeta resolveBaseVersionMeta(
+      OmSnapshotLocalData toSnapshot,
+      UUID fromSnapshotId) throws IOException {
+    OmMetadataManagerImpl metadataManager =
+        (OmMetadataManagerImpl) ozoneManager.getMetadataManager();
+    // Start walking back from the child snapshot
+    OmSnapshotLocalData child = toSnapshot;
+    int numSnapshotsTraversed = 0;
+    while (numSnapshotsTraversed <= maxSnapshotLimit && 
!child.getPreviousSnapshotId().equals(fromSnapshotId)) {
+      UUID parentId = child.getPreviousSnapshotId();
+      // Load the parent snapshot in the chain
+      child = getSnapshotLocalData(
+          getSnapshotInfo(ozoneManager,
+              metadataManager.getSnapshotChainManager(),
+              parentId));
+      numSnapshotsTraversed++;
+    }
+    if (numSnapshotsTraversed > maxSnapshotLimit) {

Review Comment:
   https://github.com/apache/ozone/pull/9079#discussion_r2408854902 added this 
based on this comment. We don't know if there could be bugs in code. it could 
be a safety condition



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