You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "amita-shukla (via GitHub)" <gi...@apache.org> on 2023/11/02 10:15:13 UTC
[PR] HDDS-9214. Remove Reclaimed snapshot status type [ozone]
amita-shukla opened a new pull request, #5536:
URL: https://github.com/apache/ozone/pull/5536
## What changes were proposed in this pull request?
This PR removes the Reclaimed Snapshot Status Type. The Reclaimed snapshot status is not used what it was intended to use for. Since garbage collection simply deletes the entry after snapshot purge, it's not needed.
This change removes `SnaphostStatus.SNAPSHOT_RECLAIMED`, its corresponding proto `SnapshotStatusProto.SNAPSHOT_RECLAIMED` and all their usages.
## What is the link to the Apache JIRA
[https://issues.apache.org/jira/browse/HDDS-9214](https://issues.apache.org/jira/browse/HDDS-9214)
## How was this patch tested?
The patch was tested by running unit test cases from the corresponding test class `TestOmSnapshotInfo`
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-9214. Remove Reclaimed snapshot status type [ozone]
Posted by "hemantk-12 (via GitHub)" <gi...@apache.org>.
hemantk-12 commented on PR #5536:
URL: https://github.com/apache/ozone/pull/5536#issuecomment-1795804069
Thanks for working on this @amita-shukla
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-9214. Remove Reclaimed snapshot status type [ozone]
Posted by "hemantk-12 (via GitHub)" <gi...@apache.org>.
hemantk-12 commented on code in PR #5536:
URL: https://github.com/apache/ozone/pull/5536#discussion_r1380591158
##########
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:
This `if` statement is not needed anymore. You can simplify it to
```
if(SnapshotInfo.SnapshotStatus.SNAPSHOT_DELETED ==
snapshotInfo.getSnapshotStatus()) {
throw new OMException("Snapshot is already deleted. "
+ "Pending reclamation.", FILE_NOT_FOUND);
}
```
or merge above if to if/else if
```
if (snapshotInfo == null) {
// Snapshot does not exist
throw new OMException("Snapshot does not exist", FILE_NOT_FOUND);
} else if (SnapshotInfo.SnapshotStatus.SNAPSHOT_DELETED ==
snapshotInfo.getSnapshotStatus()) {
throw new OMException("Snapshot is already deleted. "
+ "Pending reclamation.", FILE_NOT_FOUND);
}
```
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-9214. Remove Reclaimed snapshot status type [ozone]
Posted by "amita-shukla (via GitHub)" <gi...@apache.org>.
amita-shukla commented on code in PR #5536:
URL: https://github.com/apache/ozone/pull/5536#discussion_r1382319662
##########
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:
makes sense, thanks!
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-9214. Remove Reclaimed snapshot status type [ozone]
Posted by "aswinshakil (via GitHub)" <gi...@apache.org>.
aswinshakil commented on code in PR #5536:
URL: https://github.com/apache/ozone/pull/5536#discussion_r1380436008
##########
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(
SnapshotInfo.SnapshotStatus.SNAPSHOT_ACTIVE)) {
// If the snapshot is not in active state, throw exception as well
- switch (snapshotInfo.getSnapshotStatus()) {
- case SNAPSHOT_DELETED:
+ if (snapshotInfo.getSnapshotStatus().equals(
+ SnapshotInfo.SnapshotStatus.SNAPSHOT_DELETED)) {
throw new OMException("Snapshot is already deleted. "
- + "Pending reclamation.", FILE_NOT_FOUND);
Review Comment:
Pending reclamation here means space reclamation which will be done after the snapshot is deleted.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-9214. Remove Reclaimed snapshot status type [ozone]
Posted by "hemantk-12 (via GitHub)" <gi...@apache.org>.
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-9214. Remove Reclaimed snapshot status type [ozone]
Posted by "amita-shukla (via GitHub)" <gi...@apache.org>.
amita-shukla commented on code in PR #5536:
URL: https://github.com/apache/ozone/pull/5536#discussion_r1381131232
##########
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:
earlier, a default case existed for "Unknown snapshot non-active state". Though in all valid cases non-active state = deleted state, is it not possible to have an invalid value that falls in this category?
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-9214. Remove Reclaimed snapshot status type [ozone]
Posted by "amita-shukla (via GitHub)" <gi...@apache.org>.
amita-shukla commented on code in PR #5536:
URL: https://github.com/apache/ozone/pull/5536#discussion_r1379881742
##########
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(
SnapshotInfo.SnapshotStatus.SNAPSHOT_ACTIVE)) {
// If the snapshot is not in active state, throw exception as well
- switch (snapshotInfo.getSnapshotStatus()) {
- case SNAPSHOT_DELETED:
+ if (snapshotInfo.getSnapshotStatus().equals(
+ SnapshotInfo.SnapshotStatus.SNAPSHOT_DELETED)) {
throw new OMException("Snapshot is already deleted. "
- + "Pending reclamation.", FILE_NOT_FOUND);
Review Comment:
I have a doubt here, does this log need to be changed, as it mentions "pending reclamation"?
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-9214. Remove Reclaimed snapshot status type [ozone]
Posted by "hemantk-12 (via GitHub)" <gi...@apache.org>.
hemantk-12 merged PR #5536:
URL: https://github.com/apache/ozone/pull/5536
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org