Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-7997

The first non-existing xattr should also throw IOException

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.6.0
    • Fix Version/s: 2.8.0, 3.0.0-alpha1
    • Component/s: None
    • Labels:
      None
    • Target Version/s:
    • Hadoop Flags:
      Reviewed

      Description

      We use the following code snippet to get/set xattrs. However, if there are no xattrs have ever been set, the first getXAttr returns null and the second one just throws exception with message like "At least one of the attributes provided was not found.". This is not expected, we believe they should behave in the same way - i.e either both getXAttr returns null or both getXAttr throw exception with the message "... not found". We will provide a patch to make them both throw exception.

      ....
      attrValueNM = fs.getXAttr(path, "nm");
      if (attrValueNM == null) {
      fs.setXAttr("nm", DEFAULT_VALUE);
      }
      attrValueNN = fs.getXAttr(path, "nn");
      if (attrValueNN == null) {
      fs.setXAttr("nn", DEFAULT_VALUE);
      }
      ....

        Attachments

          Activity

            People

            • Assignee:
              sinago zhouyingchao
              Reporter:
              sinago zhouyingchao
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: