swamirishi commented on code in PR #9131:
URL: https://github.com/apache/ozone/pull/9131#discussion_r2427536133


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMDBCheckpointServletInodeBasedXfer.java:
##########
@@ -250,6 +250,17 @@ public void writeDbDataToStream(HttpServletRequest 
request, OutputStream destina
         writeDBToArchive(sstFilesToExclude, checkpointDir,
             maxTotalSstSize, archiveOutputStream, tmpdir, hardLinkFileMap, 
false);
         if (includeSnapshotData) {
+          // get the list of snapshots from the checkpoint
+          OmMetadataManagerImpl checkpointMetadataManager = null;
+          try {

Review Comment:
   ```suggestion
             try {
   ```
   ```suggestion
             try (OmMetadataManager checkpointMetadataManager = 
OmMetadataManagerImpl.createCheckpointMetadataManager(om.getConfiguration(), 
checkpoint)) {
   ```



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMDBCheckpointServletInodeBasedXfer.java:
##########
@@ -250,6 +250,17 @@ public void writeDbDataToStream(HttpServletRequest 
request, OutputStream destina
         writeDBToArchive(sstFilesToExclude, checkpointDir,
             maxTotalSstSize, archiveOutputStream, tmpdir, hardLinkFileMap, 
false);
         if (includeSnapshotData) {
+          // get the list of snapshots from the checkpoint
+          OmMetadataManagerImpl checkpointMetadataManager = null;
+          try {
+            checkpointMetadataManager =
+                
OmMetadataManagerImpl.createCheckpointMetadataManager(om.getConfiguration(), 
checkpoint);
+            snapshotPaths = getSnapshotDirs(checkpointMetadataManager);

Review Comment:
   Change getSnapshotDirs implementation to read the snapshotInfo table 
directly instead of building SnapshotChainManager which might be unoptimal 
since we build bucket chains unnecessarily



##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOMDbCheckpointServletInodeBasedXfer.java:
##########
@@ -438,6 +446,53 @@ public void testWriteDBToArchive(boolean 
expectOnlySstFiles) throws Exception {
     }
   }
 
+
+  /**
+   * SCENARIO:
+   * 1. Initially: S1->S2->S3 snapshots exist, snapshotPaths = {S1, S2, S3}
+   * 2. S3 gets purged (deleted from live OM metadata)
+   * 3. Checkpoint is created (locked point-in-time state without S3)
+   * 4. Problem: Old code uses stale snapshotPaths {S1, S2, S3} from step 1
+   * 5. Solution: Re-read snapshotPaths from checkpoint = {S1, S2} (no S3)
+   * This test verifies that checkpoint metadata manager (post-fix) excludes
+   * purged snapshots, while live metadata manager (pre-fix) would include 
them.
+   */
+  @Test
+  public void testSnapshotPathsReReadFromCheckpointAfterPurge() throws 
Exception {

Review Comment:
   Why only purge this can also affect snapshot creates



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