[ 
https://issues.apache.org/jira/browse/HDFS-16187?focusedWorklogId=643047&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-643047
 ]

ASF GitHub Bot logged work on HDFS-16187:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 28/Aug/21 00:12
            Start Date: 28/Aug/21 00:12
    Worklog Time Spent: 10m 
      Work Description: 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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 643047)
    Time Spent: 40m  (was: 0.5h)

> SnapshotDiff behaviour with Xattrs and Acls is not consistent across NN 
> restarts with checkpointing
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-16187
>                 URL: https://issues.apache.org/jira/browse/HDFS-16187
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: snapshots
>            Reporter: Srinivasu Majeti
>            Assignee: Shashikant Banerjee
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> The below test shows the snapshot diff between across snapshots is not 
> consistent with Xattr(EZ here settinh the Xattr) across NN restarts with 
> checkpointed FsImage.
> {code:java}
> @Test
> public void testEncryptionZonesWithSnapshots() throws Exception {
>   final Path snapshottable = new Path("/zones");
>   fsWrapper.mkdir(snapshottable, FsPermission.getDirDefault(),
>       true);
>   dfsAdmin.allowSnapshot(snapshottable);
>   dfsAdmin.createEncryptionZone(snapshottable, TEST_KEY, NO_TRASH);
>   fs.createSnapshot(snapshottable, "snap1");
>   SnapshotDiffReport report =
>       fs.getSnapshotDiffReport(snapshottable, "snap1", "");
>   Assert.assertEquals(0, report.getDiffList().size());
>   report =
>       fs.getSnapshotDiffReport(snapshottable, "snap1", "");
>   System.out.println(report);
>   Assert.assertEquals(0, report.getDiffList().size());
>   fs.setSafeMode(SafeModeAction.SAFEMODE_ENTER);
>   fs.saveNamespace();
>   fs.setSafeMode(SafeModeAction.SAFEMODE_LEAVE);
>   cluster.restartNameNode(true);
>   report =
>       fs.getSnapshotDiffReport(snapshottable, "snap1", "");
>   Assert.assertEquals(0, report.getDiffList().size());
> }{code}
> {code:java}
> Pre Restart:
> Difference between snapshot snap1 and current directory under directory 
> /zones:
> Post Restart:
> Difference between snapshot snap1 and current directory under directory 
> /zones:
> M .{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to