You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ja...@apache.org on 2015/11/12 21:03:53 UTC

ambari git commit: AMBARI-13827: hawq standby stop is not working (bhuvnesh2703 via jaoki)

Repository: ambari
Updated Branches:
  refs/heads/trunk 545ea7493 -> dd1741707


AMBARI-13827: hawq standby stop is not working (bhuvnesh2703 via jaoki)


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

Branch: refs/heads/trunk
Commit: dd17417072e576edd9d86ba5772ba786c72f835e
Parents: 545ea74
Author: Jun Aoki <ja...@apache.org>
Authored: Thu Nov 12 12:03:43 2015 -0800
Committer: Jun Aoki <ja...@apache.org>
Committed: Thu Nov 12 12:03:43 2015 -0800

----------------------------------------------------------------------
 .../HAWQ/2.0.0/package/scripts/hawqsegment.py             |  4 ++--
 .../HAWQ/2.0.0/package/scripts/master_helper.py           | 10 ++++++----
 .../common-services/HAWQ/2.0.0/package/scripts/utils.py   |  7 ++++---
 3 files changed, 12 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/dd174170/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqsegment.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqsegment.py b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqsegment.py
index b4be502..0e349d2 100644
--- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqsegment.py
+++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqsegment.py
@@ -50,7 +50,7 @@ class HawqSegment(Script):
     return utils.exec_hawq_operation(
           constants.START, 
           "{0} -a".format(constants.SEGMENT), 
-          not_if=utils.chk_postgres_status_cmd(params.hawq_segment_address_port))
+          not_if=utils.chk_hawq_process_status_cmd(params.hawq_segment_address_port))
 
   def start(self, env):
     self.configure(env)
@@ -67,7 +67,7 @@ class HawqSegment(Script):
   def stop(self, env):
     import params
 
-    utils.exec_hawq_operation(constants.STOP, "{0} -a".format(constants.SEGMENT), only_if=utils.chk_postgres_status_cmd(
+    utils.exec_hawq_operation(constants.STOP, "{0} -a".format(constants.SEGMENT), only_if=utils.chk_hawq_process_status_cmd(
                                 params.hawq_segment_address_port))
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/dd174170/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/master_helper.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/master_helper.py b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/master_helper.py
index 7261a04..fdfd7c9 100644
--- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/master_helper.py
+++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/master_helper.py
@@ -121,10 +121,11 @@ def __start_local_master():
   Starts HAWQ Master or HAWQ Standby Master component on the host
   """
   import params
+  component_name = __get_component_name()
   utils.exec_hawq_operation(
         constants.START, 
-        "{0} -a".format(__get_component_name()), 
-        not_if=utils.chk_postgres_status_cmd(params.hawq_master_address_port))
+        "{0} -a".format(component_name),
+        not_if=utils.chk_hawq_process_status_cmd(params.hawq_master_address_port, component_name))
 
   
 def __is_local_initialized():
@@ -183,10 +184,11 @@ def stop_master():
   Stops the HAWQ Master/Standby
   """
   import params
+  component_name = __get_component_name()
   utils.exec_hawq_operation(
                 constants.STOP,
-                "{0} -a".format(__get_component_name()),
-                only_if=utils.chk_postgres_status_cmd(params.hawq_master_address_port))
+                "{0} -a".format(component_name),
+                only_if=utils.chk_hawq_process_status_cmd(params.hawq_master_address_port, component_name))
 
 
 def __is_active_master():

http://git-wip-us.apache.org/repos/asf/ambari/blob/dd174170/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/utils.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/utils.py b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/utils.py
index da51c19..8e2b157 100644
--- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/utils.py
+++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/utils.py
@@ -23,11 +23,12 @@ from resource_management.core.logger import Logger
 
 import constants
 
-def chk_postgres_status_cmd(port):
+def chk_hawq_process_status_cmd(port, component_name=None):
   """
-  Checks if the postgres port is occupied
+  Check if hawq postgres / gpsyncmaster process is running
   """
-  return "netstat -tupln | egrep ':{0}\s' | egrep postgres".format(port)
+  process = "gpsyncmaster" if component_name == constants.STANDBY else "postgres"
+  return "netstat -tupln | egrep ':{0}\s' | egrep {1}".format(port, process)
 
 
 def create_dir_as_hawq_user(directory):