swamirishi commented on code in PR #7045:
URL: https://github.com/apache/ozone/pull/7045#discussion_r1717651407
##########
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:
```suggestion
try {
updatedSnapInfos.computeIfAbsent(snapshotTableKey, k -> {
try {
return omMetadataManager.getSnapshotInfoTable().get(k);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
});
} catch (UncheckedIOException e) {
throw e.getCause();
}
```
--
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]