You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sm...@apache.org on 2016/01/11 06:24:33 UTC

ambari git commit: AMBARI-14603. Components marked for auto-start seemingly starting even after STOP has been issued (smohanty)

Repository: ambari
Updated Branches:
  refs/heads/trunk fbeba1bf3 -> c76a47af8


AMBARI-14603. Components marked for auto-start seemingly starting even after STOP has been issued (smohanty)


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

Branch: refs/heads/trunk
Commit: c76a47af8d16380f1d13f1afe217aae75c400cd5
Parents: fbeba1b
Author: Sumit Mohanty <sm...@hortonworks.com>
Authored: Sun Jan 10 21:24:24 2016 -0800
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Sun Jan 10 21:24:24 2016 -0800

----------------------------------------------------------------------
 .../src/main/python/ambari_agent/ActionQueue.py   |  1 +
 .../main/python/ambari_agent/RecoveryManager.py   | 18 ++++++++++++------
 2 files changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c76a47af/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py b/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
index b82afe8..a4c433d 100644
--- a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
+++ b/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
@@ -98,6 +98,7 @@ class ActionQueue(threading.Thread):
                   command['serviceName'] + " of cluster " + \
                   command['clusterName'] + " to the queue.")
       self.statusCommandQueue.put(command)
+      logger.debug(pprint.pformat(command))
 
   def put(self, commands):
     for command in commands:

http://git-wip-us.apache.org/repos/asf/ambari/blob/c76a47af/ambari-agent/src/main/python/ambari_agent/RecoveryManager.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/RecoveryManager.py b/ambari-agent/src/main/python/ambari_agent/RecoveryManager.py
index a7abb8a..0692f1f 100644
--- a/ambari-agent/src/main/python/ambari_agent/RecoveryManager.py
+++ b/ambari-agent/src/main/python/ambari_agent/RecoveryManager.py
@@ -150,7 +150,9 @@ class RecoveryManager:
       self.__status_lock.acquire()
       try:
         if component not in self.statuses:
-          self.statuses[component] = copy.deepcopy(self.default_component_status)
+          component_status = copy.deepcopy(self.default_component_status)
+          component_status["stale_config"] = is_config_stale
+          self.statuses[component] = component_status
       finally:
         self.__status_lock.release()
       pass
@@ -169,7 +171,9 @@ class RecoveryManager:
       self.__status_lock.acquire()
       try:
         if component not in self.statuses:
-          self.statuses[component] = copy.deepcopy(self.default_component_status)
+          component_status = copy.deepcopy(self.default_component_status)
+          component_status["current"] = state
+          self.statuses[component] = component_status
       finally:
         self.__status_lock.release()
       pass
@@ -189,12 +193,15 @@ class RecoveryManager:
       self.__status_lock.acquire()
       try:
         if component not in self.statuses:
-          self.statuses[component] = copy.deepcopy(self.default_component_status)
+          component_status = copy.deepcopy(self.default_component_status)
+          component_status["desired"] = state
+          self.statuses[component] = component_status
       finally:
         self.__status_lock.release()
       pass
 
     self.statuses[component]["desired"] = state
+    logger.info("desired status is set to %s for %s", self.statuses[component]["desired"], component)
     if self.statuses[component]["current"] == self.statuses[component]["desired"] and \
             self.statuses[component]["stale_config"] == False:
       self.remove_command(component)
@@ -232,21 +239,20 @@ class RecoveryManager:
     if component not in self.statuses:
       return False
 
+    status = self.statuses[component]
     if self.auto_start_only:
-      status = self.statuses[component]
       if status["current"] == status["desired"]:
         return False
       if status["desired"] not in self.allowed_desired_states:
         return False
     else:
-      status = self.statuses[component]
       if status["current"] == status["desired"] and status['stale_config'] == False:
         return False
 
     if status["desired"] not in self.allowed_desired_states or status["current"] not in self.allowed_current_states:
       return False
 
-    logger.info("%s needs recovery.", component)
+    logger.info("%s needs recovery, desired = %s, and current = %s.", component, status["desired"], status["current"])
     return True
     pass