Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
HAWQ-1836. correct to parse standby state when database is unaccessible
Browse files Browse the repository at this point in the history
  • Loading branch information
ztao1987 committed Apr 5, 2022
1 parent ae505ed commit 3f7a197
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions tools/bin/hawq_ctl
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand Down

0 comments on commit 3f7a197

Please sign in to comment.