szetszwo commented on a change in pull request #3340: URL: https://github.com/apache/hadoop/pull/3340#discussion_r697772269
########## File path: hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeDirectoryAttributes.java ########## @@ -32,6 +32,11 @@ public QuotaCounts getQuotaCounts(); public boolean metadataEquals(INodeDirectoryAttributes other); + + static boolean validateFeature(INode.Feature left, INode.Feature right) { + return (left == right || + (left != null && right != null && left.equals(right))); + } Review comment: This is the same as Objects.equals(..) so that it is not needed. ########## File path: hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeDirectory.java ########## @@ -890,12 +890,14 @@ public void cleanSubtree(ReclaimContext reclaimContext, final int snapshotId, */ @Override public boolean metadataEquals(INodeDirectoryAttributes other) { - return other != null - && getQuotaCounts().equals(other.getQuotaCounts()) + return other != null && getQuotaCounts().equals(other.getQuotaCounts()) && getPermissionLong() == other.getPermissionLong() - && getAclFeature() == other.getAclFeature() - && getXAttrFeature() == other.getXAttrFeature(); + && INodeDirectoryAttributes + .validateFeature(getAclFeature(), other.getAclFeature()) + && INodeDirectoryAttributes + .validateFeature(getXAttrFeature(), other.getXAttrFeature()); Review comment: Use Objects.equals(..), i.e. ``` && Objects.equals(getAclFeature(), other.getAclFeature()) && Objects.equals(getXAttrFeature(), other.getXAttrFeature()); ``` ########## File path: hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeDirectoryAttributes.java ########## @@ -58,11 +63,12 @@ public boolean isDirectory() { @Override public boolean metadataEquals(INodeDirectoryAttributes other) { - return other != null - && getQuotaCounts().equals(other.getQuotaCounts()) + return other != null && getQuotaCounts().equals(other.getQuotaCounts()) && getPermissionLong() == other.getPermissionLong() - && getAclFeature() == other.getAclFeature() - && getXAttrFeature() == other.getXAttrFeature(); + && INodeDirectoryAttributes + .validateFeature(getAclFeature(), other.getAclFeature()) + && INodeDirectoryAttributes + .validateFeature(getXAttrFeature(), other.getXAttrFeature()); Review comment: Similar to before, use Objects.equals(..), i.e. ``` && Objects.equals(getAclFeature(), other.getAclFeature()) && Objects.equals(getXAttrFeature(), other.getXAttrFeature()); ``` -- 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: common-issues-unsubscr...@hadoop.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org