Browse Source

HDFS-7997. The first non-existing xattr should also throw IOException. (zhouyingchao via yliu)

yliu 10 years ago
parent
commit
e4cd67e9b0

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

@@ -77,6 +77,9 @@ Release 2.8.0 - UNRELEASED
     DatanodeDescriptor#updateHeartbeatState() (Brahma Reddy Battula via Colin
     P. McCabe)
 
+    HDFS-7997. The first non-existing xattr should also throw IOException.
+    (zhouyingchao via yliu)
+
 Release 2.7.0 - UNRELEASED
 
   INCOMPATIBLE CHANGES

+ 2 - 1
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirXAttrOp.java

@@ -108,7 +108,8 @@ class FSDirXAttrOp {
       return filteredAll;
     }
     if (filteredAll == null || filteredAll.isEmpty()) {
-      return null;
+      throw new IOException(
+          "At least one of the attributes provided was not found.");
     }
     List<XAttr> toGet = Lists.newArrayListWithCapacity(xAttrs.size());
     for (XAttr xAttr : xAttrs) {

+ 2 - 2
hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testXAttrConf.xml

@@ -420,8 +420,8 @@
       </cleanup-commands>
       <comparators>
       	<comparator>
-          <type>ExactComparator</type>
-          <expected-output># file: /file1#LF#</expected-output>
+          <type>SubstringComparator</type>
+          <expected-output>At least one of the attributes provided was not found</expected-output>
         </comparator>
       </comparators>
     </test>