From 3a72bfd08281fd271bef4f41289125d39c41928c Mon Sep 17 00:00:00 2001 From: Robert Kanter Date: Tue, 30 Jun 2015 16:46:41 -0700 Subject: [PATCH] MAPREDUCE-6121. JobResourceUpdater#compareFs() doesn't handle HA namespaces (rchiang via rkanter) --- hadoop-mapreduce-project/CHANGES.txt | 3 ++ .../hadoop/mapreduce/JobResourceUploader.java | 38 +------------------ 2 files changed, 4 insertions(+), 37 deletions(-) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 64b04ccc18..0baecf8f6f 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -518,6 +518,9 @@ Release 2.8.0 - UNRELEASED MAPREDUCE-6413. TestLocalJobSubmission is failing with unknown host (zhihai xu via jlowe) + MAPREDUCE-6121. JobResourceUpdater#compareFs() doesn't handle HA namespaces + (rchiang via rkanter) + Release 2.7.2 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/JobResourceUploader.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/JobResourceUploader.java index 134de35246..f3e4d2f018 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/JobResourceUploader.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/JobResourceUploader.java @@ -194,7 +194,7 @@ private Path copyRemoteFiles(Path parentDir, Path originalPath, FileSystem remoteFs = null; remoteFs = originalPath.getFileSystem(conf); - if (compareFs(remoteFs, jtFs)) { + if (FileUtil.compareFs(remoteFs, jtFs)) { return originalPath; } // this might have name collisions. copy will throw an exception @@ -205,42 +205,6 @@ private Path copyRemoteFiles(Path parentDir, Path originalPath, return newPath; } - /* - * see if two file systems are the same or not. - */ - private boolean compareFs(FileSystem srcFs, FileSystem destFs) { - URI srcUri = srcFs.getUri(); - URI dstUri = destFs.getUri(); - if (srcUri.getScheme() == null) { - return false; - } - if (!srcUri.getScheme().equals(dstUri.getScheme())) { - return false; - } - String srcHost = srcUri.getHost(); - String dstHost = dstUri.getHost(); - if ((srcHost != null) && (dstHost != null)) { - try { - srcHost = InetAddress.getByName(srcHost).getCanonicalHostName(); - dstHost = InetAddress.getByName(dstHost).getCanonicalHostName(); - } catch (UnknownHostException ue) { - return false; - } - if (!srcHost.equals(dstHost)) { - return false; - } - } else if (srcHost == null && dstHost != null) { - return false; - } else if (srcHost != null && dstHost == null) { - return false; - } - // check for ports - if (srcUri.getPort() != dstUri.getPort()) { - return false; - } - return true; - } - private void copyJar(Path originalJarPath, Path submitJarFile, short replication) throws IOException { jtFs.copyFromLocalFile(originalJarPath, submitJarFile);