[ 
https://issues.apache.org/jira/browse/HDFS-12194?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Manoj Govindassamy updated HDFS-12194:
--------------------------------------
    Description: 
When calculating snapshot diff, the metadata comparisons for Files and 
Directories are doing object reference equality (==) check instead of the 
equals() check. So, a file with the ACL set exactly same as the old one will 
still be flagged as changed. 

INodeFile and SnapshotCopy #metadataEquals()  
{noformat}
@Override
  public boolean metadataEquals(INodeFileAttributes other) {
    return other != null
        && getHeaderLong()== other.getHeaderLong()
        && getPermissionLong() == other.getPermissionLong()
        && getAclFeature() == other.getAclFeature()
        && getXAttrFeature() == other.getXAttrFeature();
  }
{noformat}


INodeDirectory, SnapshotCopy #metadataEquals()
{noformat}
  @Override
  public boolean metadataEquals(INodeDirectoryAttributes other) {
    return other != null
        && getQuotaCounts().equals(other.getQuotaCounts())
        && getPermissionLong() == other.getPermissionLong()
        && getAclFeature() == other.getAclFeature()
        && getXAttrFeature() == other.getXAttrFeature();
  }
{noformat}


  was:
Looks like the metadata comparisons for Files and Directories are doing object 
reference equality instead of the equals() check. So, a file with the ACL set 
exactly same as the old one will still flag as changed. 

INodeFile and SnapshotCopy #metadataEquals()  
{noformat}
@Override
  public boolean metadataEquals(INodeFileAttributes other) {
    return other != null
        && getHeaderLong()== other.getHeaderLong()
        && getPermissionLong() == other.getPermissionLong()
        && getAclFeature() == other.getAclFeature()
        && getXAttrFeature() == other.getXAttrFeature();
  }
{noformat}


INodeDirectory, SnapshotCopy #metadataEquals()
{noformat}
  @Override
  public boolean metadataEquals(INodeDirectoryAttributes other) {
    return other != null
        && getQuotaCounts().equals(other.getQuotaCounts())
        && getPermissionLong() == other.getPermissionLong()
        && getAclFeature() == other.getAclFeature()
        && getXAttrFeature() == other.getXAttrFeature();
  }
{noformat}



> File and Directory metadataEquals() does incorrect comparisons for Features
> ---------------------------------------------------------------------------
>
>                 Key: HDFS-12194
>                 URL: https://issues.apache.org/jira/browse/HDFS-12194
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: snapshots
>    Affects Versions: 2.8.0
>            Reporter: Manoj Govindassamy
>            Assignee: Manoj Govindassamy
>
> When calculating snapshot diff, the metadata comparisons for Files and 
> Directories are doing object reference equality (==) check instead of the 
> equals() check. So, a file with the ACL set exactly same as the old one will 
> still be flagged as changed. 
> INodeFile and SnapshotCopy #metadataEquals()  
> {noformat}
> @Override
>   public boolean metadataEquals(INodeFileAttributes other) {
>     return other != null
>         && getHeaderLong()== other.getHeaderLong()
>         && getPermissionLong() == other.getPermissionLong()
>         && getAclFeature() == other.getAclFeature()
>         && getXAttrFeature() == other.getXAttrFeature();
>   }
> {noformat}
> INodeDirectory, SnapshotCopy #metadataEquals()
> {noformat}
>   @Override
>   public boolean metadataEquals(INodeDirectoryAttributes other) {
>     return other != null
>         && getQuotaCounts().equals(other.getQuotaCounts())
>         && getPermissionLong() == other.getPermissionLong()
>         && getAclFeature() == other.getAclFeature()
>         && getXAttrFeature() == other.getXAttrFeature();
>   }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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

Reply via email to