Repository: incubator-hawq Updated Branches: refs/heads/master 914cbc1ab -> 9559ba1fe
HAWQ-1385. fix hawq_ctl stop failed when master is down, the script is trying to connect database and get acl type, but it may fail, if failed in getting the acl type, it should not break other process. Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/9559ba1f Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/9559ba1f Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/9559ba1f Branch: refs/heads/master Commit: 9559ba1fe2a8b1a8c6f5c22d63e37aff9c747b98 Parents: 914cbc1 Author: interma <[email protected]> Authored: Tue Mar 14 15:28:27 2017 +0800 Committer: Wen Lin <[email protected]> Committed: Tue Mar 14 18:08:15 2017 +0800 ---------------------------------------------------------------------- tools/bin/hawq_ctl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/9559ba1f/tools/bin/hawq_ctl ---------------------------------------------------------------------- diff --git a/tools/bin/hawq_ctl b/tools/bin/hawq_ctl index 5a9697c..976ba92 100755 --- a/tools/bin/hawq_ctl +++ b/tools/bin/hawq_ctl @@ -832,8 +832,8 @@ class HawqStop: rows = dbconn.execSQL(conn, query) conn.close() except DatabaseError, ex: - logger.error("Failed to connect to database, this script can only be run when the database is up") - sys.exit(1) + logger.warning("Failed to connect to database, cannot get hawq_acl_type") + return "unknown" for row in rows: if row[1].lower() == 'ranger': @@ -963,6 +963,9 @@ class HawqStop: logger.info("Standby master %s successfully" % self.stop_action_past) if self.hawq_acl_type == 'ranger': self.stop_rps() + if self.hawq_acl_type == 'unknown': + logger.warning("try to stop RPS when hawq_acl_type is unknown") + self.stop_rps() # Execute segment stop command on each node. segments_return_flag = self._stopAllSegments() @@ -1054,6 +1057,9 @@ class HawqStop: "Master %s failed, exit" % self.stop_action, "Master %s successfully" % self.stop_action_past) if self.hawq_acl_type == 'ranger': self.stop_rps() + if self.hawq_acl_type == 'unknown': + logger.warning("try to stop RPS when hawq_acl_type is unknown") + self.stop_rps() elif self.node_type == "standby": if self.standby_host_name.lower() not in ('', 'none'): check_return_code(self._stop_standby(), logger, \
