swamirishi commented on code in PR #7193:
URL: https://github.com/apache/ozone/pull/7193#discussion_r1772527337
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/SnapshotUtils.java:
##########
@@ -178,6 +179,43 @@ public static SnapshotInfo getNextSnapshot(OzoneManager
ozoneManager,
return null;
}
+ /**
+ * Get the previous in the snapshot chain.
+ */
+ public static SnapshotInfo getPreviousSnapshot(OzoneManager ozoneManager,
+ SnapshotChainManager
chainManager,
+ SnapshotInfo snapInfo)
+ throws IOException {
+ UUID previousSnapshotId = getPreviousSnapshotId(snapInfo, chainManager);
+ return previousSnapshotId == null ? null : getSnapshotInfo(ozoneManager,
chainManager, previousSnapshotId);
+ }
+
+ /**
+ * Get the previous in the snapshot chain.
+ */
+ public static UUID getPreviousSnapshotId(SnapshotInfo snapInfo,
+ SnapshotChainManager chainManager)
+ throws IOException {
+ // If the snapshot is deleted in the previous run, then the in-memory
+ // SnapshotChainManager might throw NoSuchElementException as the snapshot
+ // is removed in-memory but OMDoubleBuffer has not flushed yet.
+ if (snapInfo == null) {
+ throw new OMException("Snapshot Info is null. Cannot get the next
snapshot", INVALID_SNAPSHOT_ERROR);
Review Comment:
done
--
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]