This is an automated email from the ASF dual-hosted git repository.
ztao1987 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hawq.git
The following commit(s) were added to refs/heads/master by this push:
new 3f7a197a9 HAWQ-1836. correct to parse standby state when database is
unaccessible
3f7a197a9 is described below
commit 3f7a197a99f309e2718f79e82c4fcd05ee3a86ff
Author: ztao1987 <[email protected]>
AuthorDate: Tue Apr 5 23:20:30 2022 +0800
HAWQ-1836. correct to parse standby state when database is unaccessible
---
tools/bin/hawq_ctl | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/tools/bin/hawq_ctl b/tools/bin/hawq_ctl
index 81421f3fc..a29f70812 100755
--- a/tools/bin/hawq_ctl
+++ b/tools/bin/hawq_ctl
@@ -765,21 +765,16 @@ class HawqStart:
query = "select summary_state, detail_state from
gp_master_mirroring;"
rows = dbconn.execSQL(conn, query)
conn.close()
+ for row in rows:
+ if row[0] != 'Synchronized':
+ if row[1].find('Standby master too far behind') != -1:
+ return 3
+ return 2
+ else:
+ return 0
except DatabaseError, ex:
logger.error("Failed to connect to database, this script can only
be run when the database is up")
- cmd = '%s/bin/psql -p %s -d template1 -c \
- "select summary_state, detail_state from
gp_master_mirroring;"' % (self.GPHOME, self.master_port)
- (resutl, stdout, stderr) = local_ssh_output(cmd)
- if stdout.find('Standby master too far behind') != -1:
- return 3
-
- for row in rows:
- if row[0] != 'Synchronized':
- return 2
- else:
- return 0
-
def _start_segment_cmd(self):
logger.info("Start segment service")
cmd_str = "%s; %s/bin/pg_ctl start -w -t %s -D %s -l
%s/pg_log/startup.log -o \\\" -i -M %s -p %s --silent-mode=true\\\" >> %s" \