hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From templ...@apache.org
Subject [03/50] [abbrv] hadoop git commit: Addendum fix for: YARN-7269. Tracking URL in the app state does not get redirected to ApplicationMaster for Running applications. (Wangda Tan)
Date Tue, 17 Oct 2017 16:24:39 GMT
Addendum fix for: YARN-7269. Tracking URL in the app state does not get redirected to ApplicationMaster
for Running applications. (Wangda Tan)

Change-Id: If1fe4a62e07b25e6f1b8ba803495da87e2cb2df6
(cherry picked from commit 87ea1dff9c431fb88e064e497b35fc17c65f1d53)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/41e8ed7e
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/41e8ed7e
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/41e8ed7e

Branch: refs/heads/resource-types
Commit: 41e8ed7e98f3efc5a09558b7877941d327b4a04f
Parents: 1134060
Author: Wangda Tan <wangda@apache.org>
Authored: Sat Oct 14 10:41:58 2017 -0700
Committer: Wangda Tan <wangda@apache.org>
Committed: Sat Oct 14 10:45:12 2017 -0700

----------------------------------------------------------------------
 .../webproxy/amfilter/AmFilterInitializer.java      | 16 ++++++++++------
 .../webproxy/amfilter/TestAmFilterInitializer.java  |  8 ++++----
 2 files changed, 14 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/41e8ed7e/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/amfilter/AmFilterInitializer.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/amfilter/AmFilterInitializer.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/amfilter/AmFilterInitializer.java
index fa54c79..c3ddc54 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/amfilter/AmFilterInitializer.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/amfilter/AmFilterInitializer.java
@@ -62,15 +62,19 @@ public class AmFilterInitializer extends FilterInitializer {
     container.addFilter(FILTER_NAME, FILTER_CLASS, params);
 
     // Handle RM HA urls
-    List<String> urls = new ArrayList<>();
-
     // Include yarn-site.xml in the classpath
     YarnConfiguration yarnConf = new YarnConfiguration(conf);
-    for (String rmId : getRmIds(yarnConf)) {
-      String url = getUrlByRmId(yarnConf, rmId);
-      urls.add(url);
+    Collection<String> rmIds = getRmIds(yarnConf);
+    if (rmIds != null) {
+      List<String> urls = new ArrayList<>();
+      for (String rmId : rmIds) {
+        String url = getUrlByRmId(yarnConf, rmId);
+        urls.add(url);
+      }
+      if (!urls.isEmpty()) {
+        params.put(RM_HA_URLS, StringUtils.join(",", urls));
+      }
     }
-    params.put(RM_HA_URLS, StringUtils.join(",", urls));
   }
 
   private Collection<String> getRmIds(Configuration conf) {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/41e8ed7e/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/test/java/org/apache/hadoop/yarn/server/webproxy/amfilter/TestAmFilterInitializer.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/test/java/org/apache/hadoop/yarn/server/webproxy/amfilter/TestAmFilterInitializer.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/test/java/org/apache/hadoop/yarn/server/webproxy/amfilter/TestAmFilterInitializer.java
index b621012..97625ac 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/test/java/org/apache/hadoop/yarn/server/webproxy/amfilter/TestAmFilterInitializer.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/test/java/org/apache/hadoop/yarn/server/webproxy/amfilter/TestAmFilterInitializer.java
@@ -56,11 +56,11 @@ public class TestAmFilterInitializer {
     AmFilterInitializer afi = new MockAmFilterInitializer();
     assertNull(con.givenParameters);
     afi.initFilter(con, conf);
-    assertEquals(3, con.givenParameters.size());
+    assertEquals(2, con.givenParameters.size());
     assertEquals("host1", con.givenParameters.get(AmIpFilter.PROXY_HOSTS));
     assertEquals("http://host1:1000/foo",
         con.givenParameters.get(AmIpFilter.PROXY_URI_BASES));
-    assertEquals("", con.givenParameters.get(AmFilterInitializer.RM_HA_URLS));
+    assertEquals(null, con.givenParameters.get(AmFilterInitializer.RM_HA_URLS));
 
     // Check a single RM_WEBAPP_ADDRESS
     con = new MockFilterContainer();
@@ -69,11 +69,11 @@ public class TestAmFilterInitializer {
     afi = new MockAmFilterInitializer();
     assertNull(con.givenParameters);
     afi.initFilter(con, conf);
-    assertEquals(3, con.givenParameters.size());
+    assertEquals(2, con.givenParameters.size());
     assertEquals("host2", con.givenParameters.get(AmIpFilter.PROXY_HOSTS));
     assertEquals("http://host2:2000/foo",
         con.givenParameters.get(AmIpFilter.PROXY_URI_BASES));
-    assertEquals("", con.givenParameters.get(AmFilterInitializer.RM_HA_URLS));
+    assertEquals(null, con.givenParameters.get(AmFilterInitializer.RM_HA_URLS));
 
     // Check multiple RM_WEBAPP_ADDRESSes (RM HA)
     con = new MockFilterContainer();


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message