Skip to content
Permalink
Browse files
HAWQ-1836. correct to parse standby state when database is unaccessible
  • Loading branch information
ztao1987 committed Apr 5, 2022
1 parent ae505ed commit 3f7a197a99f309e2718f79e82c4fcd05ee3a86ff
Showing 1 changed file with 7 additions and 12 deletions.
@@ -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" \

0 comments on commit 3f7a197

Please sign in to comment.