This is an automated email from the ASF dual-hosted git repository.

hemant pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new ff3c071f52 HDDS-9214. Remove Reclaimed snapshot status type (#5536)
ff3c071f52 is described below

commit ff3c071f52310289c01dafbe0a6939e8e65c5398
Author: Amita Shukla <[email protected]>
AuthorDate: Mon Nov 6 23:45:15 2023 +0530

    HDDS-9214. Remove Reclaimed snapshot status type (#5536)
---
 .../hadoop/ozone/om/helpers/SnapshotInfo.java      | 13 +++--------
 .../src/main/proto/OmClientProtocol.proto          |  3 +--
 .../request/snapshot/OMSnapshotDeleteRequest.java  | 25 +++++++++-------------
 3 files changed, 14 insertions(+), 27 deletions(-)

diff --git 
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/SnapshotInfo.java
 
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/SnapshotInfo.java
index ec429bc6a6..a9065c03fe 100644
--- 
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/SnapshotInfo.java
+++ 
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/SnapshotInfo.java
@@ -64,13 +64,11 @@ public final class SnapshotInfo implements Auditable, 
CopyObject<SnapshotInfo> {
   }
 
   /**
-   * SnapshotStatus enum composed of
-   * active, deleted and reclaimed statues.
+   * SnapshotStatus enum composed of active and deleted statuses.
    */
   public enum SnapshotStatus {
     SNAPSHOT_ACTIVE,
-    SNAPSHOT_DELETED,
-    SNAPSHOT_RECLAIMED;
+    SNAPSHOT_DELETED;
 
     public static final SnapshotStatus DEFAULT = SNAPSHOT_ACTIVE;
 
@@ -80,8 +78,6 @@ public final class SnapshotInfo implements Auditable, 
CopyObject<SnapshotInfo> {
         return SnapshotStatusProto.SNAPSHOT_ACTIVE;
       case SNAPSHOT_DELETED:
         return SnapshotStatusProto.SNAPSHOT_DELETED;
-      case SNAPSHOT_RECLAIMED:
-        return SnapshotStatusProto.SNAPSHOT_RECLAIMED;
       default:
         throw new IllegalStateException(
             "BUG: missing valid SnapshotStatus, found status=" + this);
@@ -94,8 +90,6 @@ public final class SnapshotInfo implements Auditable, 
CopyObject<SnapshotInfo> {
         return SNAPSHOT_ACTIVE;
       case SNAPSHOT_DELETED:
         return SNAPSHOT_DELETED;
-      case SNAPSHOT_RECLAIMED:
-        return SNAPSHOT_RECLAIMED;
       default:
         throw new IllegalStateException(
             "BUG: missing valid SnapshotStatus, found status=" + status);
@@ -135,8 +129,7 @@ public final class SnapshotInfo implements Auditable, 
CopyObject<SnapshotInfo> {
    * @param name - snapshot name.
    * @param volumeName - volume name.
    * @param bucketName - bucket name.
-   * @param snapshotStatus - status: SNAPSHOT_ACTIVE, SNAPSHOT_DELETED,
-   *                      SNAPSHOT_RECLAIMED
+   * @param snapshotStatus - status: SNAPSHOT_ACTIVE, SNAPSHOT_DELETED
    * @param creationTime - Snapshot creation time.
    * @param deletionTime - Snapshot deletion time.
    * @param pathPreviousSnapshotId - Snapshot path previous snapshot id.
diff --git 
a/hadoop-ozone/interface-client/src/main/proto/OmClientProtocol.proto 
b/hadoop-ozone/interface-client/src/main/proto/OmClientProtocol.proto
index a3fbdb2258..e460474316 100644
--- a/hadoop-ozone/interface-client/src/main/proto/OmClientProtocol.proto
+++ b/hadoop-ozone/interface-client/src/main/proto/OmClientProtocol.proto
@@ -811,12 +811,11 @@ message PrefixInfo {
 
 /**
  * SnapshotStatus - snapshot states.
- * Snapshot in one of : active, deleted, or reclaimed state
+ * Snapshot in one of : active or deleted state
  */
 enum SnapshotStatusProto {
   SNAPSHOT_ACTIVE = 1;
   SNAPSHOT_DELETED = 2;
-  SNAPSHOT_RECLAIMED = 3;
 }
 
 /**
diff --git 
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/snapshot/OMSnapshotDeleteRequest.java
 
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/snapshot/OMSnapshotDeleteRequest.java
index 3c0e20bb19..2e9ff59104 100644
--- 
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/snapshot/OMSnapshotDeleteRequest.java
+++ 
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/snapshot/OMSnapshotDeleteRequest.java
@@ -158,21 +158,16 @@ public class OMSnapshotDeleteRequest extends 
OMClientRequest {
         throw new OMException("Snapshot does not exist", FILE_NOT_FOUND);
       }
 
-      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:
-          throw new OMException("Snapshot is already deleted. "
-              + "Pending reclamation.", FILE_NOT_FOUND);
-        case SNAPSHOT_RECLAIMED:
-          throw new OMException("Snapshot is already deleted and reclaimed.",
-              FILE_NOT_FOUND);
-        default:
-          // Unknown snapshot non-active state
-          throw new OMException("Snapshot exists but no longer in active 
state",
-              FILE_NOT_FOUND);
-        }
+      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);
       }
 
       // Mark snapshot as deleted


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to