hadoop-yarn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zjs...@apache.org
Subject svn commit: r1583836 - in /hadoop/common/branches/branch-2.4/hadoop-yarn-project: ./ hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/ hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/...
Date Wed, 02 Apr 2014 00:06:29 GMT
Author: zjshen
Date: Wed Apr  2 00:06:29 2014
New Revision: 1583836

URL: http://svn.apache.org/r1583836
Log:
YARN-1898. Made Standby RM links conf, stacks, logLevel, metrics, jmx, logs and static not
be redirected to Active RM. Contributed by Xuan Gong.
svn merge --ignore-ancestry -c 1583833 ../../trunk/

Modified:
    hadoop/common/branches/branch-2.4/hadoop-yarn-project/CHANGES.txt
    hadoop/common/branches/branch-2.4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestRMFailover.java
    hadoop/common/branches/branch-2.4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebAppFilter.java

Modified: hadoop/common/branches/branch-2.4/hadoop-yarn-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.4/hadoop-yarn-project/CHANGES.txt?rev=1583836&r1=1583835&r2=1583836&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.4/hadoop-yarn-project/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2.4/hadoop-yarn-project/CHANGES.txt Wed Apr  2 00:06:29
2014
@@ -10,7 +10,10 @@ Release 2.4.1 - UNRELEASED
 
   OPTIMIZATIONS
 
-  BUG FIXES 
+  BUG FIXES
+
+    YARN-1898. Made Standby RM links conf, stacks, logLevel, metrics, jmx, logs
+    and static not be redirected to Active RM. (Xuan Gong via zjshen)
 
 Release 2.4.0 - 2014-04-07 
 

Modified: hadoop/common/branches/branch-2.4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestRMFailover.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestRMFailover.java?rev=1583836&r1=1583835&r2=1583836&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestRMFailover.java
(original)
+++ hadoop/common/branches/branch-2.4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestRMFailover.java
Wed Apr  2 00:06:29 2014
@@ -270,9 +270,33 @@ public class TestRMFailover extends Clie
     String header = getHeader("Refresh", rm2Url);
     assertTrue(header.contains("; url=" + rm1Url));
 
+    // standby RM links /conf, /stacks, /logLevel, /metrics, /jmx,
+    // /static, /logs, /cluster/cluster as well as webService
+    // /ws/v1/cluster/info should not be redirected to active RM
     header = getHeader("Refresh", rm2Url + "/cluster/cluster");
     assertEquals(null, header);
 
+    header = getHeader("Refresh", rm2Url + "/conf");
+    assertEquals(null, header);
+
+    header = getHeader("Refresh", rm2Url + "/stacks");
+    assertEquals(null, header);
+
+    header = getHeader("Refresh", rm2Url + "/logLevel");
+    assertEquals(null, header);
+
+    header = getHeader("Refresh", rm2Url + "/metrics");
+    assertEquals(null, header);
+
+    header = getHeader("Refresh", rm2Url + "/jmx");
+    assertEquals(null, header);
+
+    header = getHeader("Refresh", rm2Url + "/static");
+    assertEquals(null, header);
+
+    header = getHeader("Refresh", rm2Url + "/logs");
+    assertEquals(null, header);
+
     header = getHeader("Refresh", rm2Url + "/ws/v1/cluster/info");
     assertEquals(null, header);
 

Modified: hadoop/common/branches/branch-2.4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebAppFilter.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebAppFilter.java?rev=1583836&r1=1583835&r2=1583836&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebAppFilter.java
(original)
+++ hadoop/common/branches/branch-2.4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebAppFilter.java
Wed Apr  2 00:06:29 2014
@@ -20,6 +20,7 @@ package org.apache.hadoop.yarn.server.re
 
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.util.Set;
 
 import javax.inject.Inject;
 import javax.inject.Singleton;
@@ -30,6 +31,7 @@ import javax.servlet.http.HttpServletRes
 
 import org.apache.hadoop.http.HtmlQuoting;
 
+import com.google.common.collect.Sets;
 import com.google.inject.Injector;
 import com.sun.jersey.guice.spi.container.servlet.GuiceContainer;
 
@@ -42,6 +44,10 @@ public class RMWebAppFilter extends Guic
    */
   private static final long serialVersionUID = 1L;
 
+  // define a set of URIs which do not need to do redirection
+  private static final Set<String> NON_REDIRECTED_URIS = Sets.newHashSet(
+      "/conf", "/stacks", "/logLevel", "/metrics", "/jmx", "/logs");
+
   @Inject
   public RMWebAppFilter(Injector injector) {
     super(injector);
@@ -61,8 +67,7 @@ public class RMWebAppFilter extends Guic
     RMWebApp rmWebApp = injector.getInstance(RMWebApp.class);
     rmWebApp.checkIfStandbyRM();
     if (rmWebApp.isStandby()
-        && !uri.equals("/" + rmWebApp.wsName() + "/v1/cluster/info")
-        && !uri.equals("/" + rmWebApp.name() + "/cluster")) {
+        && shouldRedirect(rmWebApp, uri)) {
       String redirectPath = rmWebApp.getRedirectPath() + uri;
 
       if (redirectPath != null && !redirectPath.isEmpty()) {
@@ -80,4 +85,9 @@ public class RMWebAppFilter extends Guic
 
   }
 
+  private boolean shouldRedirect(RMWebApp rmWebApp, String uri) {
+    return !uri.equals("/" + rmWebApp.wsName() + "/v1/cluster/info")
+        && !uri.equals("/" + rmWebApp.name() + "/cluster")
+        && !NON_REDIRECTED_URIS.contains(uri);
+  }
 }



Mime
View raw message