smengcl commented on code in PR #4244:
URL: https://github.com/apache/ozone/pull/4244#discussion_r1106508231
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/snapshot/OMSnapshotCreateRequest.java:
##########
@@ -146,6 +149,26 @@ public OMClientResponse
validateAndUpdateCache(OzoneManager ozoneManager,
.getLatestSequenceNumber();
snapshotInfo.setDbTxSequenceNumber(dbLatestSequenceNumber);
+ // Set previous path and global snapshot
+ String latestPathSnapshot =
+ snapshotChainManager.getLatestPathSnapshot(snapshotPath);
+ String latestGlobalSnapshot =
+ snapshotChainManager.getLatestGlobalSnapshot();
+
+ if (latestPathSnapshot == null || latestPathSnapshot.isEmpty()) {
+ snapshotInfo.setPathPreviousSnapshotID("");
+ } else {
+ snapshotInfo.setPathPreviousSnapshotID(latestPathSnapshot);
+ }
+
+ if (latestGlobalSnapshot == null || latestGlobalSnapshot.isEmpty()) {
+ snapshotInfo.setGlobalPreviousSnapshotID("");
+ } else {
+ snapshotInfo.setGlobalPreviousSnapshotID(latestGlobalSnapshot);
+ }
+
+ snapshotChainManager.addSnapshot(snapshotInfo);
Review Comment:
CMIIW but this seems to be the only place where snapshots are added to OM's
`SnapshotChainManager`?
Since `SnapshotChainManager` persists its entire state in-memory, we will
have to reconstruct the snapshot chain on OM startup (reconstruct from scratch
first, persist it later if too time consuming).
--
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]