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

Distcp fails in Hadoop 3.x when 2.x source webhdfs url has special characters in hdfs file path

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.2.0
    • Fix Version/s: 3.3.0, 3.2.1, 3.1.3
    • Component/s: webhdfs
    • Labels:
      None

      Description

      There was an enhancement to allow semicolon in source/target URLs for distcp use case as part of HDFS-13176 and backward compatibility fix as part of HDFS-13582 . Still there seems to be an issue when trying to trigger distcp from 3.x cluster to pull webhdfs data from 2.x hadoop cluster. We might need to deal with existing fix as described below by making sure if url is already encoded or not. That fixes it. 

      diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java
      index 5936603c34a..dc790286aff 100644
      — a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java
      +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java
      @@ -609,7 +609,10 @@ URL toUrl(final HttpOpParam.Op op, final Path fspath,
      boolean pathAlreadyEncoded = false;
      try {
      fspathUriDecoded = URLDecoder.decode(fspathUri.getPath(), "UTF-8");

      • pathAlreadyEncoded = true;
        + if(!fspathUri.getPath().equals(fspathUriDecoded))
        + { + pathAlreadyEncoded = true; + }

        } catch (IllegalArgumentException ex)

        { LOG.trace("Cannot decode URL encoded file", ex); }

       

       

        Attachments

        1. HDFS-14323v0.patch
          1 kB
          Srinivasu Majeti

          Issue Links

            Activity

              People

              • Assignee:
                smajeti Srinivasu Majeti
                Reporter:
                smajeti Srinivasu Majeti
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: