hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject hadoop git commit: YARN-4927. TestRMHA#testTransitionedToActiveRefreshFail fails with FairScheduler. (Bibin A Chundatt via kasha)
Date Mon, 05 Jun 2017 16:16:33 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2.7 d1f71aaf0 -> abf959f57


YARN-4927. TestRMHA#testTransitionedToActiveRefreshFail fails with FairScheduler. (Bibin A
Chundatt via kasha)

(cherry picked from commit ff95fd547b3030529983fa4e701ac728c54ab63a)


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

Branch: refs/heads/branch-2.7
Commit: abf959f57a289590016c6c818cd0df9d4d6d1013
Parents: d1f71aa
Author: Karthik Kambatla <kasha@apache.org>
Authored: Sat Apr 9 10:31:02 2016 -0700
Committer: Sunil G <sunilg@apache.org>
Committed: Mon Jun 5 21:46:12 2017 +0530

----------------------------------------------------------------------
 .../server/resourcemanager/AdminService.java    |  6 ++-
 .../yarn/server/resourcemanager/TestRMHA.java   | 42 +++++++++++++-------
 2 files changed, 32 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/abf959f5/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/AdminService.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/AdminService.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/AdminService.java
index 64078dd..1443846 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/AdminService.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/AdminService.java
@@ -631,7 +631,11 @@ public class AdminService extends CompositeService implements
     return conf;
   }
 
-  private void refreshAll() throws ServiceFailedException {
+  /*
+   * Visibility could be private for test its made as default
+   */
+  @VisibleForTesting
+  void refreshAll() throws ServiceFailedException {
     try {
       checkAcls("refreshAll");
       refreshQueues();

http://git-wip-us.apache.org/repos/asf/hadoop/blob/abf959f5/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMHA.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMHA.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMHA.java
index 62cfe84..5eb3025 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMHA.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMHA.java
@@ -35,6 +35,7 @@ import org.apache.hadoop.ha.HAServiceProtocol;
 import org.apache.hadoop.ha.HAServiceProtocol.HAServiceState;
 import org.apache.hadoop.ha.HAServiceProtocol.StateChangeRequestInfo;
 import org.apache.hadoop.ha.HealthCheckFailedException;
+import org.apache.hadoop.ha.ServiceFailedException;
 import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
 import org.apache.hadoop.net.NetUtils;
 import org.apache.hadoop.security.AccessControlException;
@@ -54,7 +55,6 @@ import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
 import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt;
 import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptState;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueMetrics;
-import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration;
 import org.codehaus.jettison.json.JSONException;
 import org.codehaus.jettison.json.JSONObject;
 import org.junit.Assert;
@@ -580,19 +580,28 @@ public class TestRMHA {
     assertEquals(0, rm.getRMContext().getRMApps().size());
   }
 
-  @Test(timeout = 90000)
+  @Test(timeout = 9000000)
   public void testTransitionedToActiveRefreshFail() throws Exception {
     configuration.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, false);
-    YarnConfiguration conf = new YarnConfiguration(configuration);
-    configuration = new CapacitySchedulerConfiguration(conf);
     rm = new MockRM(configuration) {
       @Override
       protected AdminService createAdminService() {
         return new AdminService(this, getRMContext()) {
+          int counter = 0;
           @Override
           protected void setConfig(Configuration conf) {
             super.setConfig(configuration);
           }
+
+          @Override
+          protected void refreshAll() throws ServiceFailedException {
+            if (counter == 0) {
+              counter++;
+              throw new ServiceFailedException("Simulate RefreshFail");
+            } else {
+              super.refreshAll();
+            }
+          }
         };
       }
 
@@ -607,23 +616,26 @@ public class TestRMHA {
     final StateChangeRequestInfo requestInfo =
         new StateChangeRequestInfo(
             HAServiceProtocol.RequestSource.REQUEST_BY_USER);
-
-    configuration.set("yarn.scheduler.capacity.root.default.capacity", "100");
+    FailFastDispatcher dispatcher =
+        ((FailFastDispatcher) rm.rmContext.getDispatcher());
+    // Verify transistion to transitionToStandby
     rm.adminService.transitionToStandby(requestInfo);
-    assertEquals(HAServiceState.STANDBY, rm.getRMContext().getHAServiceState());
-    configuration.set("yarn.scheduler.capacity.root.default.capacity", "200");
+    assertEquals("Fatal Event should be 0", 0, dispatcher.getEventCount());
+    assertEquals("HA state should be in standBy State", HAServiceState.STANDBY,
+        rm.getRMContext().getHAServiceState());
     try {
+      // Verify refreshAll call failure and check fail Event is dispatched
       rm.adminService.transitionToActive(requestInfo);
+      Assert.fail("Transistion to Active should have failed for refreshAll()");
     } catch (Exception e) {
-      assertTrue("Error on refreshAll during transistion to Active".contains(e
-          .getMessage()));
+      assertTrue("Service fail Exception expected",
+          e instanceof ServiceFailedException);
     }
-    FailFastDispatcher dispatcher =
-        ((FailFastDispatcher) rm.rmContext.getDispatcher());
+    // Since refreshAll failed we are expecting fatal event to be send
+    // Then fatal event is send RM will shutdown
     dispatcher.await();
-    assertEquals(1, dispatcher.getEventCount());
-    // Making correct conf and check the state
-    configuration.set("yarn.scheduler.capacity.root.default.capacity", "100");
+    assertEquals("Fatal Event to be received", 1, dispatcher.getEventCount());
+    // Check of refreshAll success HA can be active
     rm.adminService.transitionToActive(requestInfo);
     assertEquals(HAServiceState.ACTIVE, rm.getRMContext().getHAServiceState());
     rm.adminService.transitionToStandby(requestInfo);


---------------------------------------------------------------------
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