You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "neils-dev (via GitHub)" <gi...@apache.org> on 2023/02/16 01:33:44 UTC

[GitHub] [ozone] neils-dev commented on a diff in pull request #4244: HDDS-7740. Implement SnapshotDeletingService

neils-dev commented on code in PR #4244:
URL: https://github.com/apache/ozone/pull/4244#discussion_r1107915544


##########
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:
   @smengcl , 
   
   > we will have to reconstruct the snapshot chain during OM startup (first implementation could reconstruct it from snapshotInfoTable.
   
   On OM startup to reconstruct the chain from persistent storage (`snapshotInfoTable`), is done internally by the `SnapshotChainManager `on instantiation.  When the metadatamanager creates its `SnapshotChainManager`, the instance initializes the chain in memory loading the snapshots found in the snapshotInfoTable.  This is done with `SnapshotChainManager.loadFromSnapshotInfoTable`.  This method is private and used in the constructor.
   
   Not sure if the new jira is needed as when the OM startups up the chain should be initialized with the contents of the persistent store `SnapshotInfoTable`.
   
   https://github.com/apache/ozone/blob/874108337421a1204b41ceaf1f0a85ab5de77f50/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/SnapshotChainManager.java#L249
   



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org