smengcl commented on code in PR #4306:
URL: https://github.com/apache/ozone/pull/4306#discussion_r1120770050
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmSnapshotManager.java:
##########
@@ -95,9 +97,11 @@ public OmSnapshot load(@Nonnull String snapshotTableKey)
// see if the snapshot exists
snapshotInfo = getSnapshotInfo(snapshotTableKey);
- boolean isSnapshotInCache =
+ CacheValue<SnapshotInfo> cacheValue =
ozoneManager.getMetadataManager().getSnapshotInfoTable()
- .getCacheValue(new CacheKey<>(snapshotTableKey)) != null;
+ .getCacheValue(new CacheKey<>(snapshotTableKey));
+ boolean isSnapshotInCache = cacheValue != null && Optional.ofNullable(
+ cacheValue.getCacheValue()).isPresent();
Review Comment:
Verified manually that this approach would work:
<img width="1469" alt="image"
src="https://user-images.githubusercontent.com/50227127/221980152-37acb87e-31ae-45e6-b7a7-4f897d0139d2.png">
--
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]