You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/01/30 18:35:35 UTC

[GitHub] [hadoop-ozone] hanishakoneru opened a new pull request #510: HDDS-2958. Handle replay of OM Volume ACL requests

hanishakoneru opened a new pull request #510: HDDS-2958. Handle replay of OM Volume ACL requests
URL: https://github.com/apache/hadoop-ozone/pull/510
 
 
   ## What changes were proposed in this pull request?
   
   To ensure that volume acl operations are idempotent, compare the transactionID with the objectID and updateID to make sure that the transaction is not a replay. If the transactionID <= updateID, then it implies that the transaction is a replay and hence it should be skipped.
   
   OMVolumeAclRequests (Add, Remove and Set ACL requests) are made idempotent in this Jira.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-2958
   
   ## How was this patch tested?
   
   Unit test added.
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] bharatviswa504 commented on a change in pull request #510: HDDS-2958. Handle replay of OM Volume ACL requests

Posted by GitBox <gi...@apache.org>.
bharatviswa504 commented on a change in pull request #510: HDDS-2958. Handle replay of OM Volume ACL requests
URL: https://github.com/apache/hadoop-ozone/pull/510#discussion_r373723057
 
 

 ##########
 File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/volume/acl/OMVolumeAclRequest.java
 ##########
 @@ -73,53 +74,71 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager,
 
     OMMetadataManager omMetadataManager = ozoneManager.getMetadataManager();
     boolean lockAcquired = false;
+    Result result = null;
     try {
       // check Acl
       if (ozoneManager.getAclsEnabled()) {
         checkAcls(ozoneManager, OzoneObj.ResourceType.VOLUME,
             OzoneObj.StoreType.OZONE, IAccessAuthorizer.ACLType.WRITE_ACL,
             volume, null, null);
       }
-      lockAcquired =
-          omMetadataManager.getLock().acquireWriteLock(VOLUME_LOCK, volume);
+      lockAcquired = omMetadataManager.getLock().acquireWriteLock(
+          VOLUME_LOCK, volume);
       String dbVolumeKey = omMetadataManager.getVolumeKey(volume);
       omVolumeArgs = omMetadataManager.getVolumeTable().get(dbVolumeKey);
       if (omVolumeArgs == null) {
         throw new OMException(OMException.ResultCodes.VOLUME_NOT_FOUND);
       }
 
+      // Check if this transaction is a replay of ratis logs.
+      // If this is a replay, then the response has already been returned to
+      // the client. So take no further action and return a dummy
+      // OMClientResponse.
+      if (isReplay(ozoneManager, omVolumeArgs.getUpdateID(),
+          trxnLogIndex)) {
+        throw new OMReplayException();
+      }
+
       // result is false upon add existing acl or remove non-existing acl
-      boolean result = true;
+      boolean applyAcl = true;
       try {
         omVolumeAclOp.apply(ozoneAcls, omVolumeArgs);
       } catch (OMException ex) {
-        result = false;
+        applyAcl = false;
       }
 
-      if (result) {
+      if (applyAcl) {
+        omVolumeArgs.setUpdateID(trxnLogIndex);
 
 Review comment:
   No when replay it will not be considered as replay as UpdateID will be less than transaction ID. As we are doing best effort to find all the replay cases, I think we can set updateID when applyAcl false and it will help in replay.
   
   > So this would add an unnecessary DB op.
   
   We are using DoubleBuffer and Batch, so we should be fine here.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] bharatviswa504 commented on a change in pull request #510: HDDS-2958. Handle replay of OM Volume ACL requests

Posted by GitBox <gi...@apache.org>.
bharatviswa504 commented on a change in pull request #510: HDDS-2958. Handle replay of OM Volume ACL requests
URL: https://github.com/apache/hadoop-ozone/pull/510#discussion_r373338978
 
 

 ##########
 File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/volume/acl/OMVolumeSetAclRequest.java
 ##########
 @@ -80,29 +80,36 @@ public String getVolumeName() {
 
   @Override
   OMClientResponse onSuccess(OMResponse.Builder omResponse,
-      OmVolumeArgs omVolumeArgs, boolean result){
+      OmVolumeArgs omVolumeArgs, boolean aclApplied){
     omResponse.setSetAclResponse(OzoneManagerProtocolProtos.SetAclResponse
-        .newBuilder().setResponse(result).build());
-    return new OMVolumeAclOpResponse(omVolumeArgs, omResponse.build());
+        .newBuilder().setResponse(aclApplied).build());
+    return new OMVolumeAclOpResponse(omResponse.build(), omVolumeArgs);
   }
 
   @Override
   OMClientResponse onFailure(OMResponse.Builder omResponse,
       IOException ex) {
-    return new OMVolumeAclOpResponse(null,
-        createErrorOMResponse(omResponse, ex));
+    return new OMVolumeAclOpResponse(createErrorOMResponse(omResponse, ex));
   }
 
   @Override
-  void onComplete(IOException ex) {
-    if (ex == null) {
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("Set acls: {} to volume: {} success!",
-            getAcls(), getVolumeName());
-      }
-    } else {
-      LOG.error("Set acls {} to volume {} failed!",
-          getAcls(), getVolumeName(), ex);
+  void onComplete(Result result, IOException ex, long trxnLogIndex) {
+    switch (result) {
+    case SUCCESS:
+      LOG.debug("Set acls: {} to volume: {} success!", getAcls(),
 
 Review comment:
   Removed isDebugEnabled.
   Need same in other requests also. (I see it is missing in other requests)

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] hanishakoneru commented on issue #510: HDDS-2958. Handle replay of OM Volume ACL requests

Posted by GitBox <gi...@apache.org>.
hanishakoneru commented on issue #510: HDDS-2958. Handle replay of OM Volume ACL requests
URL: https://github.com/apache/hadoop-ozone/pull/510#issuecomment-582165407
 
 
   Thanks @bharatviswa504 for the review. Update the patch to address your comments.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] hanishakoneru commented on issue #510: HDDS-2958. Handle replay of OM Volume ACL requests

Posted by GitBox <gi...@apache.org>.
hanishakoneru commented on issue #510: HDDS-2958. Handle replay of OM Volume ACL requests
URL: https://github.com/apache/hadoop-ozone/pull/510#issuecomment-584401582
 
 
   Thank you @bharatviswa504 and @arp7 for the reviews. 
   CI run is green. I will merge this PR.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] arp7 commented on issue #510: HDDS-2958. Handle replay of OM Volume ACL requests

Posted by GitBox <gi...@apache.org>.
arp7 commented on issue #510: HDDS-2958. Handle replay of OM Volume ACL requests
URL: https://github.com/apache/hadoop-ozone/pull/510#issuecomment-584162028
 
 
   Kicked off retest.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] bharatviswa504 commented on a change in pull request #510: HDDS-2958. Handle replay of OM Volume ACL requests

Posted by GitBox <gi...@apache.org>.
bharatviswa504 commented on a change in pull request #510: HDDS-2958. Handle replay of OM Volume ACL requests
URL: https://github.com/apache/hadoop-ozone/pull/510#discussion_r373335734
 
 

 ##########
 File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/volume/acl/OMVolumeSetAclRequest.java
 ##########
 @@ -80,29 +80,36 @@ public String getVolumeName() {
 
   @Override
   OMClientResponse onSuccess(OMResponse.Builder omResponse,
-      OmVolumeArgs omVolumeArgs, boolean result){
+      OmVolumeArgs omVolumeArgs, boolean aclApplied){
     omResponse.setSetAclResponse(OzoneManagerProtocolProtos.SetAclResponse
-        .newBuilder().setResponse(result).build());
-    return new OMVolumeAclOpResponse(omVolumeArgs, omResponse.build());
+        .newBuilder().setResponse(aclApplied).build());
+    return new OMVolumeAclOpResponse(omResponse.build(), omVolumeArgs);
   }
 
   @Override
   OMClientResponse onFailure(OMResponse.Builder omResponse,
       IOException ex) {
-    return new OMVolumeAclOpResponse(null,
-        createErrorOMResponse(omResponse, ex));
+    return new OMVolumeAclOpResponse(createErrorOMResponse(omResponse, ex));
   }
 
   @Override
-  void onComplete(IOException ex) {
-    if (ex == null) {
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("Set acls: {} to volume: {} success!",
-            getAcls(), getVolumeName());
-      }
-    } else {
-      LOG.error("Set acls {} to volume {} failed!",
-          getAcls(), getVolumeName(), ex);
+  void onComplete(Result result, IOException ex, long trxnLogIndex) {
 
 Review comment:
   Same applies for all requests.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] hanishakoneru commented on a change in pull request #510: HDDS-2958. Handle replay of OM Volume ACL requests

Posted by GitBox <gi...@apache.org>.
hanishakoneru commented on a change in pull request #510: HDDS-2958. Handle replay of OM Volume ACL requests
URL: https://github.com/apache/hadoop-ozone/pull/510#discussion_r373607488
 
 

 ##########
 File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/volume/acl/OMVolumeSetAclRequest.java
 ##########
 @@ -80,29 +80,36 @@ public String getVolumeName() {
 
   @Override
   OMClientResponse onSuccess(OMResponse.Builder omResponse,
-      OmVolumeArgs omVolumeArgs, boolean result){
+      OmVolumeArgs omVolumeArgs, boolean aclApplied){
     omResponse.setSetAclResponse(OzoneManagerProtocolProtos.SetAclResponse
-        .newBuilder().setResponse(result).build());
-    return new OMVolumeAclOpResponse(omVolumeArgs, omResponse.build());
+        .newBuilder().setResponse(aclApplied).build());
+    return new OMVolumeAclOpResponse(omResponse.build(), omVolumeArgs);
   }
 
   @Override
   OMClientResponse onFailure(OMResponse.Builder omResponse,
       IOException ex) {
-    return new OMVolumeAclOpResponse(null,
-        createErrorOMResponse(omResponse, ex));
+    return new OMVolumeAclOpResponse(createErrorOMResponse(omResponse, ex));
   }
 
   @Override
-  void onComplete(IOException ex) {
-    if (ex == null) {
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("Set acls: {} to volume: {} success!",
-            getAcls(), getVolumeName());
-      }
-    } else {
-      LOG.error("Set acls {} to volume {} failed!",
-          getAcls(), getVolumeName(), ex);
+  void onComplete(Result result, IOException ex, long trxnLogIndex) {
 
 Review comment:
   We are using it to log the exception in case of FAILURE.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] bharatviswa504 commented on a change in pull request #510: HDDS-2958. Handle replay of OM Volume ACL requests

Posted by GitBox <gi...@apache.org>.
bharatviswa504 commented on a change in pull request #510: HDDS-2958. Handle replay of OM Volume ACL requests
URL: https://github.com/apache/hadoop-ozone/pull/510#discussion_r373723123
 
 

 ##########
 File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/volume/acl/OMVolumeSetAclRequest.java
 ##########
 @@ -80,29 +80,36 @@ public String getVolumeName() {
 
   @Override
   OMClientResponse onSuccess(OMResponse.Builder omResponse,
-      OmVolumeArgs omVolumeArgs, boolean result){
+      OmVolumeArgs omVolumeArgs, boolean aclApplied){
     omResponse.setSetAclResponse(OzoneManagerProtocolProtos.SetAclResponse
-        .newBuilder().setResponse(result).build());
-    return new OMVolumeAclOpResponse(omVolumeArgs, omResponse.build());
+        .newBuilder().setResponse(aclApplied).build());
+    return new OMVolumeAclOpResponse(omResponse.build(), omVolumeArgs);
   }
 
   @Override
   OMClientResponse onFailure(OMResponse.Builder omResponse,
       IOException ex) {
-    return new OMVolumeAclOpResponse(null,
-        createErrorOMResponse(omResponse, ex));
+    return new OMVolumeAclOpResponse(createErrorOMResponse(omResponse, ex));
   }
 
   @Override
-  void onComplete(IOException ex) {
-    if (ex == null) {
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("Set acls: {} to volume: {} success!",
-            getAcls(), getVolumeName());
-      }
-    } else {
-      LOG.error("Set acls {} to volume {} failed!",
-          getAcls(), getVolumeName(), ex);
+  void onComplete(Result result, IOException ex, long trxnLogIndex) {
 
 Review comment:
   Yes, missed it.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] hanishakoneru merged pull request #510: HDDS-2958. Handle replay of OM Volume ACL requests

Posted by GitBox <gi...@apache.org>.
hanishakoneru merged pull request #510: HDDS-2958. Handle replay of OM Volume ACL requests
URL: https://github.com/apache/hadoop-ozone/pull/510
 
 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] hanishakoneru commented on a change in pull request #510: HDDS-2958. Handle replay of OM Volume ACL requests

Posted by GitBox <gi...@apache.org>.
hanishakoneru commented on a change in pull request #510: HDDS-2958. Handle replay of OM Volume ACL requests
URL: https://github.com/apache/hadoop-ozone/pull/510#discussion_r373608423
 
 

 ##########
 File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/volume/acl/OMVolumeAclRequest.java
 ##########
 @@ -73,53 +74,71 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager,
 
     OMMetadataManager omMetadataManager = ozoneManager.getMetadataManager();
     boolean lockAcquired = false;
+    Result result = null;
     try {
       // check Acl
       if (ozoneManager.getAclsEnabled()) {
         checkAcls(ozoneManager, OzoneObj.ResourceType.VOLUME,
             OzoneObj.StoreType.OZONE, IAccessAuthorizer.ACLType.WRITE_ACL,
             volume, null, null);
       }
-      lockAcquired =
-          omMetadataManager.getLock().acquireWriteLock(VOLUME_LOCK, volume);
+      lockAcquired = omMetadataManager.getLock().acquireWriteLock(
+          VOLUME_LOCK, volume);
       String dbVolumeKey = omMetadataManager.getVolumeKey(volume);
       omVolumeArgs = omMetadataManager.getVolumeTable().get(dbVolumeKey);
       if (omVolumeArgs == null) {
         throw new OMException(OMException.ResultCodes.VOLUME_NOT_FOUND);
       }
 
+      // Check if this transaction is a replay of ratis logs.
+      // If this is a replay, then the response has already been returned to
+      // the client. So take no further action and return a dummy
+      // OMClientResponse.
+      if (isReplay(ozoneManager, omVolumeArgs.getUpdateID(),
+          trxnLogIndex)) {
+        throw new OMReplayException();
+      }
+
       // result is false upon add existing acl or remove non-existing acl
-      boolean result = true;
+      boolean applyAcl = true;
       try {
         omVolumeAclOp.apply(ozoneAcls, omVolumeArgs);
       } catch (OMException ex) {
-        result = false;
+        applyAcl = false;
       }
 
-      if (result) {
+      if (applyAcl) {
+        omVolumeArgs.setUpdateID(trxnLogIndex);
 
 Review comment:
   We do not update the DB in case applyAcl is false. So this would add an unnecessary DB op. Tradeoff is replay transaction would also check and reach the same decision - applyAcl false. So I think it should be ok here. Thoughts?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] bharatviswa504 commented on a change in pull request #510: HDDS-2958. Handle replay of OM Volume ACL requests

Posted by GitBox <gi...@apache.org>.
bharatviswa504 commented on a change in pull request #510: HDDS-2958. Handle replay of OM Volume ACL requests
URL: https://github.com/apache/hadoop-ozone/pull/510#discussion_r373335649
 
 

 ##########
 File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/volume/acl/OMVolumeSetAclRequest.java
 ##########
 @@ -80,29 +80,36 @@ public String getVolumeName() {
 
   @Override
   OMClientResponse onSuccess(OMResponse.Builder omResponse,
-      OmVolumeArgs omVolumeArgs, boolean result){
+      OmVolumeArgs omVolumeArgs, boolean aclApplied){
     omResponse.setSetAclResponse(OzoneManagerProtocolProtos.SetAclResponse
-        .newBuilder().setResponse(result).build());
-    return new OMVolumeAclOpResponse(omVolumeArgs, omResponse.build());
+        .newBuilder().setResponse(aclApplied).build());
+    return new OMVolumeAclOpResponse(omResponse.build(), omVolumeArgs);
   }
 
   @Override
   OMClientResponse onFailure(OMResponse.Builder omResponse,
       IOException ex) {
-    return new OMVolumeAclOpResponse(null,
-        createErrorOMResponse(omResponse, ex));
+    return new OMVolumeAclOpResponse(createErrorOMResponse(omResponse, ex));
   }
 
   @Override
-  void onComplete(IOException ex) {
-    if (ex == null) {
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("Set acls: {} to volume: {} success!",
-            getAcls(), getVolumeName());
-      }
-    } else {
-      LOG.error("Set acls {} to volume {} failed!",
-          getAcls(), getVolumeName(), ex);
+  void onComplete(Result result, IOException ex, long trxnLogIndex) {
 
 Review comment:
   Now no use of exception here. Unused param

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] bharatviswa504 commented on a change in pull request #510: HDDS-2958. Handle replay of OM Volume ACL requests

Posted by GitBox <gi...@apache.org>.
bharatviswa504 commented on a change in pull request #510: HDDS-2958. Handle replay of OM Volume ACL requests
URL: https://github.com/apache/hadoop-ozone/pull/510#discussion_r373336598
 
 

 ##########
 File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/volume/acl/OMVolumeAclRequest.java
 ##########
 @@ -73,53 +74,71 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager,
 
     OMMetadataManager omMetadataManager = ozoneManager.getMetadataManager();
     boolean lockAcquired = false;
+    Result result = null;
     try {
       // check Acl
       if (ozoneManager.getAclsEnabled()) {
         checkAcls(ozoneManager, OzoneObj.ResourceType.VOLUME,
             OzoneObj.StoreType.OZONE, IAccessAuthorizer.ACLType.WRITE_ACL,
             volume, null, null);
       }
-      lockAcquired =
-          omMetadataManager.getLock().acquireWriteLock(VOLUME_LOCK, volume);
+      lockAcquired = omMetadataManager.getLock().acquireWriteLock(
+          VOLUME_LOCK, volume);
       String dbVolumeKey = omMetadataManager.getVolumeKey(volume);
       omVolumeArgs = omMetadataManager.getVolumeTable().get(dbVolumeKey);
       if (omVolumeArgs == null) {
         throw new OMException(OMException.ResultCodes.VOLUME_NOT_FOUND);
       }
 
+      // Check if this transaction is a replay of ratis logs.
+      // If this is a replay, then the response has already been returned to
+      // the client. So take no further action and return a dummy
+      // OMClientResponse.
+      if (isReplay(ozoneManager, omVolumeArgs.getUpdateID(),
+          trxnLogIndex)) {
+        throw new OMReplayException();
+      }
+
       // result is false upon add existing acl or remove non-existing acl
-      boolean result = true;
+      boolean applyAcl = true;
       try {
         omVolumeAclOp.apply(ozoneAcls, omVolumeArgs);
       } catch (OMException ex) {
-        result = false;
+        applyAcl = false;
       }
 
-      if (result) {
+      if (applyAcl) {
+        omVolumeArgs.setUpdateID(trxnLogIndex);
 
 Review comment:
   We need to set updateID even in the case of applyAcl false.
   Scenario:
   1. Add Acl T1
   2. Add existing Acl T2
   
   Now replay T2 it will not be considered as replay as updateID will be still 1.
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org