You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sw...@apache.org on 2013/08/15 03:53:50 UTC

git commit: AMBARI-2905. SNAMENODE should not start at HA cluster. (swagle)

Updated Branches:
  refs/heads/trunk 8a11fdd86 -> e65468a6c


AMBARI-2905. SNAMENODE should not start at HA cluster. (swagle)


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

Branch: refs/heads/trunk
Commit: e65468a6c09b7dc1133ff973443cef8f956a962b
Parents: 8a11fdd
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Wed Aug 14 18:48:36 2013 -0700
Committer: Siddharth Wagle <sw...@hortonworks.com>
Committed: Wed Aug 14 18:53:27 2013 -0700

----------------------------------------------------------------------
 .../ambari/server/agent/HeartbeatMonitor.java    |  3 ++-
 .../server/agent/TestHeartbeatMonitor.java       | 19 ++++++++++++++++---
 2 files changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/e65468a6/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
index 0e9a62b..f556ab2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
@@ -133,7 +133,8 @@ public class HeartbeatMonitor implements Runnable {
                 !sch.getState().equals(State.INIT) &&
                 !sch.getState().equals(State.INSTALLING) &&
                 !sch.getState().equals(State.INSTALL_FAILED) &&
-                !sch.getState().equals(State.UNINSTALLED)) {
+                !sch.getState().equals(State.UNINSTALLED) &&
+                !sch.getState().equals(State.MAINTENANCE)) {
               LOG.warn("Setting component state to UNKNOWN for component " + sc.getName() + " on " + host);
               sch.setState(State.UNKNOWN);
             }

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/e65468a6/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java
index b8db8c7..fd45a48 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java
@@ -49,6 +49,7 @@ import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.State;
 import org.apache.ambari.server.state.fsm.InvalidStateTransitionException;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostInstallEvent;
+import org.apache.ambari.server.state.svccomphost.ServiceComponentHostMaintenanceEvent;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostOpSucceededEvent;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostStartedEvent;
 import org.junit.After;
@@ -426,6 +427,18 @@ public class TestHeartbeatMonitor {
         // installing
         sch.handleEvent(new ServiceComponentHostInstallEvent(
             sch.getServiceComponentName(), sch.getHostName(), System.currentTimeMillis(), "HDP-0.1"));
+      } else if (sch.getServiceComponentName().equals("SECONDARY_NAMENODE"))  {
+        // installing
+        sch.handleEvent(new ServiceComponentHostInstallEvent(
+          sch.getServiceComponentName(), sch.getHostName(), System.currentTimeMillis(), "HDP-0.1"));
+
+        // installed
+        sch.handleEvent(new ServiceComponentHostOpSucceededEvent(sch.getServiceComponentName(),
+          sch.getHostName(), System.currentTimeMillis()));
+
+        // maintenance
+        sch.handleEvent(new ServiceComponentHostMaintenanceEvent(sch.getServiceComponentName(),
+          sch.getHostName(), System.currentTimeMillis()));
       }
     }
     
@@ -455,9 +468,9 @@ public class TestHeartbeatMonitor {
         assertEquals(sch.getServiceComponentName(), State.INSTALLING, sch.getState());
       else if (sc.isClientComponent())
         assertEquals(sch.getServiceComponentName(), State.INIT, sch.getState());
+      else if (sch.getServiceComponentName().equals("SECONDARY_NAMENODE"))
+        assertEquals(sch.getServiceComponentName(), State.MAINTENANCE,
+          sch.getState());
     }
-
-    
-    
   }
 }