Forráskód Böngészése

HDFS-7148. TestEncryptionZones#testIsEncryptedMethod fails on branch-2 after archival storage merge. (wang)

Andrew Wang 10 éve
szülő
commit
09c324a4a8

+ 3 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

@@ -480,6 +480,9 @@ Release 2.6.0 - UNRELEASED
     HDFS-7049. TestByteRangeInputStream.testPropagatedClose fails and throw
     NPE on branch-2. (Juan Yu via wheat9)
 
+    HDFS-7148. TestEncryptionZones#testIsEncryptedMethod fails on branch-2
+    after archival storage merge. (wang)
+
     BREAKDOWN OF HDFS-6134 AND HADOOP-10150 SUBTASKS AND RELATED JIRAS
   
       HDFS-6387. HDFS CLI admin tool for creating & deleting an

+ 7 - 6
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java

@@ -1404,9 +1404,10 @@ public class FSDirectory implements Closeable {
       if (srcs.endsWith(HdfsConstants.SEPARATOR_DOT_SNAPSHOT_DIR)) {
         return getSnapshotsListing(srcs, startAfter);
       }
-      final INodesInPath inodesInPath = getLastINodeInPath(srcs);
+      final INodesInPath inodesInPath = getINodesInPath(srcs, true);
+      final INode[] inodes = inodesInPath.getINodes();
       final int snapshot = inodesInPath.getPathSnapshotId();
-      final INode targetNode = inodesInPath.getLastINode();
+      final INode targetNode = inodes[inodes.length - 1];
       if (targetNode == null)
         return null;
       byte parentStoragePolicy = isSuperUser ?
@@ -1515,7 +1516,8 @@ public class FSDirectory implements Closeable {
       byte policyId = includeStoragePolicy && i != null && !i.isSymlink() ?
           i.getStoragePolicyID() : BlockStoragePolicySuite.ID_UNSPECIFIED;
       return i == null ? null : createFileStatus(HdfsFileStatus.EMPTY_NAME, i,
-          policyId, inodesInPath.getPathSnapshotId(), isRawPath, inodesInPath);
+          policyId, inodesInPath.getPathSnapshotId(), isRawPath,
+          inodesInPath);
     } finally {
       readUnlock();
     }
@@ -2186,7 +2188,6 @@ public class FSDirectory implements Closeable {
       }
     }
   }
-
   
   /**
    * This method is always called with writeLock of FSDirectory held.
@@ -2835,7 +2836,7 @@ public class FSDirectory implements Closeable {
    * @return consolidated file encryption info; null for non-encrypted files
    */
   FileEncryptionInfo getFileEncryptionInfo(INode inode, int snapshotId,
-                                           INodesInPath iip) throws IOException {
+      INodesInPath iip) throws IOException {
     if (!inode.isFile()) {
       return null;
     }
@@ -3037,7 +3038,7 @@ public class FSDirectory implements Closeable {
   }
 
   private XAttr unprotectedGetXAttrByName(INode inode, int snapshotId,
-                                          String xAttrName)
+      String xAttrName)
       throws IOException {
     List<XAttr> xAttrs = XAttrStorage.readINodeXAttrs(inode, snapshotId);
     if (xAttrs == null) {