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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: ozone-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: ozone-issues-h...@hadoop.apache.org