aswinshakil commented on code in PR #6139:
URL: https://github.com/apache/ozone/pull/6139#discussion_r1484909417
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmSnapshotManager.java:
##########
@@ -325,19 +326,25 @@ public boolean canDisableFsSnapshot(OMMetadataManager
ommm) {
return isSnapshotInfoTableEmpty;
}
- private CacheLoader<String, OmSnapshot> createCacheLoader() {
- return new CacheLoader<String, OmSnapshot>() {
+ private CacheLoader<UUID, OmSnapshot> createCacheLoader() {
+ return new CacheLoader<UUID, OmSnapshot>() {
@Nonnull
@Override
- public OmSnapshot load(@Nonnull String snapshotTableKey)
- throws IOException {
- // Check if the snapshot exists
- final SnapshotInfo snapshotInfo = getSnapshotInfo(snapshotTableKey);
+ public OmSnapshot load(@Nonnull UUID snapshotId) throws IOException {
+ String snapshotTableKey = ((OmMetadataManagerImpl)
ozoneManager.getMetadataManager())
+ .getSnapshotChainManager()
+ .getTableKey(snapshotId);
+
+ // SnapshotChain maintains in-memory reverse mapping of snapshotId to
snapshotName based on snapshotInfoTable.
+ // So it should not happen ideally.
+ // If it happens, then either snapshot has been purged in between or
SnapshotChain is corrupted
+ // and missing some entries which needs investigation.
+ if (snapshotTableKey == null) {
+ throw new IOException("No snapshot exist with snapshotId: " +
snapshotId);
+ }
- // Block snapshot from loading when it is no longer active e.g.
DELETED,
- // unless this is called from SnapshotDeletingService.
- checkSnapshotActive(snapshotInfo, true);
Review Comment:
We needed it as a rail guard so that `DELETED` snapshot is not loaded by
other services. But I don't think we would need it. Reason is that we already
block FS calls to snapshot, We check snapshot status in snapDiff for each page.
Make sense to remove this.
--
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]