diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index bd50ea8e48..211dfc27ac 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -4610,24 +4610,6 @@ ANY num_sync ( - promote_trigger_file (string) - - promote_trigger_file configuration parameter - - - - - Specifies a trigger file whose presence ends recovery in the - standby. Even if this value is not set, you can still promote - the standby using pg_ctl promote or calling - pg_promote(). - This parameter can only be set in the postgresql.conf - file or on the server command line. - - - - hot_standby (boolean) diff --git a/doc/src/sgml/high-availability.sgml b/doc/src/sgml/high-availability.sgml index b2b3129397..d85788338c 100644 --- a/doc/src/sgml/high-availability.sgml +++ b/doc/src/sgml/high-availability.sgml @@ -653,11 +653,11 @@ protocol to make nodes agree on a serializable transactional order. Standby mode is exited and the server switches to normal operation - when pg_ctl promote is run, - pg_promote() is called, or a trigger file is found - (promote_trigger_file). Before failover, - any WAL immediately available in the archive or in pg_wal will be - restored, but no attempt is made to connect to the primary. + when pg_ctl promote is run, or + pg_promote() is called. Use of + promote_trigger_file is deprecated. Before failover, + any WAL immediately available in the archive or in pg_wal + will be restored, but no attempt is made to connect to the primary. @@ -1483,12 +1483,8 @@ synchronous_standby_names = 'ANY 2 (s1, s2, s3)' To trigger failover of a log-shipping standby server, run - pg_ctl promote, call pg_promote(), - or create a trigger file with the file name and path specified by the - promote_trigger_file. If you're planning to use - pg_ctl promote or to call - pg_promote() to fail over, - promote_trigger_file is not required. If you're + pg_ctl promote or call pg_promote(). + Use of promote_trigger_file is deprecated. If you're setting up the reporting servers that are only used to offload read-only queries from the primary, not for high availability purposes, you don't need to promote it. diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c index cb07694aea..41414ec669 100644 --- a/src/backend/access/transam/xlogrecovery.c +++ b/src/backend/access/transam/xlogrecovery.c @@ -95,7 +95,6 @@ int recovery_min_apply_delay = 0; /* options formerly taken from recovery.conf for XLOG streaming */ char *PrimaryConnInfo = NULL; char *PrimarySlotName = NULL; -char *PromoteTriggerFile = NULL; bool wal_receiver_create_temp_slot = false; /* @@ -3840,14 +3839,14 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess, XLogPrefetcherComputeStats(xlogprefetcher); /* - * Wait for more WAL to arrive. Time out after 5 seconds - * to react to a trigger file promptly and to check if the - * WAL receiver is still active. + * Wait for more WAL to arrive, when we will be woken + * immediately by the WAL receiver. Use of trigger file + * via promote_trigger_file is now deprecated. */ (void) WaitLatch(&XLogRecoveryCtl->recoveryWakeupLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 5000L, WAIT_EVENT_RECOVERY_WAL_STREAM); + WL_LATCH_SET | WL_EXIT_ON_PM_DEATH, + -1L, + WAIT_EVENT_RECOVERY_WAL_STREAM); ResetLatch(&XLogRecoveryCtl->recoveryWakeupLatch); break; } @@ -4300,8 +4299,6 @@ SetPromoteIsTriggered(void) static bool CheckForStandbyTrigger(void) { - struct stat stat_buf; - if (LocalPromoteIsTriggered) return true; @@ -4314,23 +4311,6 @@ CheckForStandbyTrigger(void) return true; } - if (PromoteTriggerFile == NULL || strcmp(PromoteTriggerFile, "") == 0) - return false; - - if (stat(PromoteTriggerFile, &stat_buf) == 0) - { - ereport(LOG, - (errmsg("promote trigger file found: %s", PromoteTriggerFile))); - unlink(PromoteTriggerFile); - SetPromoteIsTriggered(); - return true; - } - else if (errno != ENOENT) - ereport(ERROR, - (errcode_for_file_access(), - errmsg("could not stat promote trigger file \"%s\": %m", - PromoteTriggerFile))); - return false; } diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c index 836b49484a..2cefdee581 100644 --- a/src/backend/utils/misc/guc_tables.c +++ b/src/backend/utils/misc/guc_tables.c @@ -3799,16 +3799,6 @@ struct config_string ConfigureNamesString[] = check_recovery_target_lsn, assign_recovery_target_lsn, NULL }, - { - {"promote_trigger_file", PGC_SIGHUP, REPLICATION_STANDBY, - gettext_noop("Specifies a file name whose presence ends recovery in the standby."), - NULL - }, - &PromoteTriggerFile, - "", - NULL, NULL, NULL - }, - { {"primary_conninfo", PGC_SIGHUP, REPLICATION_STANDBY, gettext_noop("Sets the connection string to be used to connect to the sending server."), diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index 868d21c351..043864597f 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -331,7 +331,6 @@ #primary_conninfo = '' # connection string to sending server #primary_slot_name = '' # replication slot on sending server -#promote_trigger_file = '' # file name whose presence ends recovery #hot_standby = on # "off" disallows queries during recovery # (change requires restart) #max_standby_archive_delay = 30s # max delay before canceling queries