Skip to content

Commit 3e5e5b0

Browse files
smajeti22jojochuang
authored andcommitted
HDFS-14323. Distcp fails in Hadoop 3.x when 2.x source webhdfs url has special characters in hdfs file path. Contributed by Srinivasu Majeti.
Signed-off-by: Wei-Chiu Chuang <[email protected]>
1 parent 4cb3da6 commit 3e5e5b0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,13 @@ URL toUrl(final HttpOpParam.Op op, final Path fspath,
609609
boolean pathAlreadyEncoded = false;
610610
try {
611611
fspathUriDecoded = URLDecoder.decode(fspathUri.getPath(), "UTF-8");
612-
pathAlreadyEncoded = true;
612+
//below condition check added as part of fixing HDFS-14323 to make
613+
//sure pathAlreadyEncoded is not set in the case the input url does
614+
//not have any encoded sequence already.This will help pulling data
615+
//from 2.x hadoop cluster to 3.x using 3.x distcp client operation
616+
if(!fspathUri.getPath().equals(fspathUriDecoded)) {
617+
pathAlreadyEncoded = true;
618+
}
613619
} catch (IllegalArgumentException ex) {
614620
LOG.trace("Cannot decode URL encoded file", ex);
615621
}

0 commit comments

Comments
 (0)