hemantk-12 commented on code in PR #7045:
URL: https://github.com/apache/ozone/pull/7045#discussion_r1719123454


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/snapshot/OMSnapshotPurgeRequest.java:
##########
@@ -287,18 +219,25 @@ private void updateSnapshotChainAndCache(
       metadataManager.getSnapshotInfoTable().addCacheEntry(
           new CacheKey<>(nextPathSnapInfo.getTableKey()),
           CacheValue.get(trxnLogIndex, nextPathSnapInfo));
-      updatedPathPreviousAndGlobalSnapshots
-          .put(nextPathSnapInfo.getTableKey(), nextPathSnapInfo);
     } else if (nextGlobalSnapInfo != null) {
       nextGlobalSnapInfo.setGlobalPreviousSnapshotId(
           snapInfo.getGlobalPreviousSnapshotId());
       metadataManager.getSnapshotInfoTable().addCacheEntry(
           new CacheKey<>(nextGlobalSnapInfo.getTableKey()),
           CacheValue.get(trxnLogIndex, nextGlobalSnapInfo));
-      updatedPathPreviousAndGlobalSnapshots
-          .put(nextGlobalSnapInfo.getTableKey(), nextGlobalSnapInfo);
     }
 
     snapshotChainManager.deleteSnapshot(snapInfo);
   }
+
+  private SnapshotInfo getUpdatedSnapshotInfo(String snapshotTableKey, 
OMMetadataManager omMetadataManager)
+      throws IOException {
+    if (updatedSnapshotInfos.containsKey(snapshotTableKey)) {
+      return updatedSnapshotInfos.get(snapshotTableKey);
+    } else {
+      SnapshotInfo snapshotInfo = 
omMetadataManager.getSnapshotInfoTable().get(snapshotTableKey);
+      updatedSnapshotInfos.put(snapshotTableKey, snapshotInfo);
+      return snapshotInfo;
+    }

Review Comment:
   I don't think it matters in this case 1). It is in memory map 2). I doubt 
the key space is going to be more than 100.
   
   Still, I changed the code to do one look-up to address your concern.
   



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