Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-10625

Configuration: names should be trimmed when putting/getting to properties

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.0
    • Fix Version/s: 2.5.0
    • Component/s: conf
    • Labels:
      None

      Description

      Currently, Hadoop will not trim name when putting a pair of k/v to property. But when loading configuration from file, names will be trimmed:
      (In Configuration.java)

                if ("name".equals(field.getTagName()) && field.hasChildNodes())
                  attr = StringInterner.weakIntern(
                      ((Text)field.getFirstChild()).getData().trim());
                if ("value".equals(field.getTagName()) && field.hasChildNodes())
                  value = StringInterner.weakIntern(
                      ((Text)field.getFirstChild()).getData());
      

      With this behavior, following steps will be problematic:
      1. User incorrectly set " hadoop.key=value" (with a space before hadoop.key)
      2. User try to get "hadoop.key", cannot get "value"
      3. Serialize/deserialize configuration (Like what did in MR)
      4. User try to get "hadoop.key", can get "value", which will make inconsistency problem.

        Attachments

        1. HADOOP-10625.patch
          3 kB
          Wangda Tan
        2. HADOOP-10625.patch
          4 kB
          Wangda Tan
        3. HADOOP-10625.patch
          4 kB
          Wangda Tan

          Activity

            People

            • Assignee:
              leftnoteasy Wangda Tan
              Reporter:
              leftnoteasy Wangda Tan
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: