This is an automated email from the ASF dual-hosted git repository. maxyang pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit f48d78c28fa684c931359c86102c70cac287ec03 Author: Ashwin Agrawal <[email protected]> AuthorDate: Wed Jul 6 15:58:18 2022 -0700 Add writing CHECKPOINT to gpactivatestandby Commit 1fe901d removed the rety loop for checking if promotion is completed for standby. As side effect it also deleted the logic to force CHECKPOINT after promotion. Bring that logic back as it required to write CHECKPOINT after pg_ctl promote mainly to satisfy tests. pg_ctl promote uses fast_promotion and hence pg_controlfile gets updated with status as DB_IN_PRODUCTION but given CHECKPOINT is not forced the TLI value is not updated. gpstart uses the TLI value to validate if standby is promoted or not. Hence, bringing back the logic to force CHECKPOINT after promotion. --- gpMgmt/bin/gpactivatestandby | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/gpMgmt/bin/gpactivatestandby b/gpMgmt/bin/gpactivatestandby index 831355d196..4aa5e8a97d 100755 --- a/gpMgmt/bin/gpactivatestandby +++ b/gpMgmt/bin/gpactivatestandby @@ -321,6 +321,21 @@ def promote_standby(coordinator_data_dir): cmd = gp.Command('pg_ctl promote', 'pg_ctl promote -D %s -t 600' % coordinator_data_dir) cmd.run(validateAfter=True) + logger.info('Standby coordinator is promoted') + + # After promotion run CHECKPOINT to force the new TimeLineID to be + # written to the pg_control file. This happens in async way in + # server since pg_ctl promote uses fast_promote. Given gpstart + # depends on TLI to be reflect after right after promotion mainly + # for testing we force CHECKPOINT here. + logger.debug('forcing CHECKPOINT to reflect new TimeLineID...') + try: + dburl = dbconn.DbURL() + conn = dbconn.connect(dburl, utility=True, logConn=False) + dbconn.execSQL(conn, 'CHECKPOINT') + conn.close() + except pygresql.InternalError as e: + pass #------------------------------------------------------------------------- # Main --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
