Skip to content

Commit cebf98d

Browse files
committed
Addressed review comments.
1 parent 1f43713 commit cebf98d

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeDirectory.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import java.util.Iterator;
2525
import java.util.List;
2626
import java.util.Map;
27-
import java.util.Objects;
2827

2928
import org.apache.hadoop.fs.PathIsNotDirectoryException;
3029
import org.apache.hadoop.fs.permission.FsAction;
@@ -894,7 +893,7 @@ public boolean metadataEquals(INodeDirectoryAttributes other) {
894893
return other != null && getQuotaCounts().equals(other.getQuotaCounts())
895894
&& getPermissionLong() == other.getPermissionLong()
896895
&& getAclFeature() == other.getAclFeature()
897-
&& Objects.equals(getXAttrFeature(), other.getXAttrFeature());
896+
&& getXAttrFeature() == other.getXAttrFeature();
898897
}
899898

900899

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeDirectoryAttributes.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
import org.apache.hadoop.thirdparty.com.google.common.base.Preconditions;
2626

27-
import java.util.Objects;
2827

2928
/**
3029
* The attributes of an inode.
@@ -63,7 +62,7 @@ public boolean metadataEquals(INodeDirectoryAttributes other) {
6362
return other != null && getQuotaCounts().equals(other.getQuotaCounts())
6463
&& getPermissionLong() == other.getPermissionLong()
6564
&& getAclFeature() == other.getAclFeature()
66-
&& Objects.equals(getXAttrFeature(), other.getXAttrFeature());
65+
&& getXAttrFeature() == other.getXAttrFeature();
6766
}
6867
}
6968

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/snapshot/Snapshot.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,14 @@
2424
import java.util.Arrays;
2525
import java.util.Comparator;
2626
import java.util.Date;
27+
import java.util.Objects;
28+
2729
import org.apache.hadoop.classification.InterfaceAudience;
2830
import org.apache.hadoop.fs.Path;
2931
import org.apache.hadoop.hdfs.DFSUtil;
3032
import org.apache.hadoop.hdfs.protocol.HdfsConstants;
3133
import org.apache.hadoop.hdfs.server.namenode.AclFeature;
34+
import org.apache.hadoop.hdfs.server.namenode.INodeDirectoryAttributes;
3235
import org.apache.hadoop.hdfs.server.namenode.ContentSummaryComputationContext;
3336
import org.apache.hadoop.hdfs.server.namenode.DirectoryWithQuotaFeature;
3437
import org.apache.hadoop.hdfs.server.namenode.FSImageFormat;
@@ -196,6 +199,18 @@ public ContentSummaryComputationContext computeContentSummary(
196199
return computeDirectoryContentSummary(summary, snapshotId);
197200
}
198201

202+
@Override
203+
public boolean metadataEquals(INodeDirectoryAttributes other) {
204+
return other != null && getQuotaCounts().equals(other.getQuotaCounts())
205+
&& getPermissionLong() == other.getPermissionLong()
206+
// Acl feature maintains a reference counted map, thereby
207+
// every snapshot copy should point to the same Acl object unless
208+
// there is no change in acl values.
209+
// Reference equals is hence intentional here.
210+
&& getAclFeature() == other.getAclFeature()
211+
&& Objects.equals(getXAttrFeature(), other.getXAttrFeature());
212+
}
213+
199214
@Override
200215
public String getFullPathName() {
201216
return getSnapshotPath(getParent().getFullPathName(), getLocalName());

0 commit comments

Comments
 (0)