hemantk-12 commented on code in PR #5536:
URL: https://github.com/apache/ozone/pull/5536#discussion_r1381970330
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/snapshot/OMSnapshotDeleteRequest.java:
##########
@@ -161,14 +161,11 @@ public OMClientResponse
validateAndUpdateCache(OzoneManager ozoneManager,
if (!snapshotInfo.getSnapshotStatus().equals(
Review Comment:
`SnapshotStatus` is a enum and can have `SNAPSHOT_ACTIVE` or
`SNAPSHOT_DELETED` value. Default value was used earlier because we were using
switch. As of now I don't think it is possible to have any value other than
`SNAPSHOT_ACTIVE` or `SNAPSHOT_DELETED` because we are reading it from RocksDB
and deserialization will fail in case of data corruption or something. I
believe it was added to handle new case status type added to `SnapshotStatus`.
If you want to keep the default status, you can do something like this:
```
switch (snapshotInfo.getSnapshotStatus()) {
case SNAPSHOT_DELETED:
throw new OMException("Snapshot is already deleted. "
+ "Pending reclamation.", FILE_NOT_FOUND);
case SNAPSHOT_ACTIVE:
break;
default:
// Unknown snapshot non-active state
throw new OMException("Snapshot exists but no longer in active
state",
FILE_NOT_FOUND);
}
```
and `SNAPSHOT_ACTIVE` check can be removed.
--
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]