hibernate_startup.v6.patch
application/octet-stream
Filename: hibernate_startup.v6.patch
Type: application/octet-stream
Part: 0
Patch
Format: unified
Series: patch v6
| File | + | − |
|---|---|---|
| doc/src/sgml/config.sgml | 6 | 3 |
| doc/src/sgml/high-availability.sgml | 7 | 11 |
| src/backend/access/transam/xlogrecovery.c | 7 | 4 |
| src/backend/utils/misc/guc_tables.c | 2 | 1 |
| src/backend/utils/misc/postgresql.conf.sample | 0 | 1 |
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 559eb898a9..391bcb4306 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -4615,9 +4615,12 @@ ANY <replaceable class="parameter">num_sync</replaceable> ( <replaceable class="
<listitem>
<para>
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 <command>pg_ctl promote</command> or calling
- <function>pg_promote()</function>.
+ standby, though this may take as long as 60s to take effect.
+ This mechanism is now deprecated and will be removed in a later
+ release. The preferred mechanism by which to promote the standby
+ is by using <command>pg_ctl promote</command> or calling
+ <function>pg_promote()</function>, both of which promote much
+ faster than using this parameter.
This parameter can only be set in the <filename>postgresql.conf</filename>
file or on the server command line.
</para>
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.
<para>
Standby mode is exited and the server switches to normal operation
- when <command>pg_ctl promote</command> is run,
- <function>pg_promote()</function> is called, or a trigger file is found
- (<varname>promote_trigger_file</varname>). Before failover,
- any WAL immediately available in the archive or in <filename>pg_wal</filename> will be
- restored, but no attempt is made to connect to the primary.
+ when <command>pg_ctl promote</command> is run, or
+ <function>pg_promote()</function> is called. Use of
+ <varname>promote_trigger_file</varname> is deprecated. Before failover,
+ any WAL immediately available in the archive or in <filename>pg_wal</filename>
+ will be restored, but no attempt is made to connect to the primary.
</para>
</sect2>
@@ -1483,12 +1483,8 @@ synchronous_standby_names = 'ANY 2 (s1, s2, s3)'
<para>
To trigger failover of a log-shipping standby server, run
- <command>pg_ctl promote</command>, call <function>pg_promote()</function>,
- or create a trigger file with the file name and path specified by the
- <varname>promote_trigger_file</varname>. If you're planning to use
- <command>pg_ctl promote</command> or to call
- <function>pg_promote()</function> to fail over,
- <varname>promote_trigger_file</varname> is not required. If you're
+ <command>pg_ctl promote</command> or call <function>pg_promote()</function>.
+ Use of <varname>promote_trigger_file</varname> 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..2ba81e91eb 100644
--- a/src/backend/access/transam/xlogrecovery.c
+++ b/src/backend/access/transam/xlogrecovery.c
@@ -3840,14 +3840,17 @@ 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. Hibernate, but time out
+ * to react to a trigger file. Direct use of trigger file
+ * is now deprecated and the promote_trigger_file will be
+ * removed in a later release.
*/
(void) WaitLatch(&XLogRecoveryCtl->recoveryWakeupLatch,
WL_LATCH_SET | WL_TIMEOUT |
WL_EXIT_ON_PM_DEATH,
- 5000L, WAIT_EVENT_RECOVERY_WAL_STREAM);
+ 60000L,
+ WAIT_EVENT_RECOVERY_WAL_STREAM);
ResetLatch(&XLogRecoveryCtl->recoveryWakeupLatch);
break;
}
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index 836b49484a..38aca5dac4 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -3802,7 +3802,8 @@ struct config_string ConfigureNamesString[] =
{
{"promote_trigger_file", PGC_SIGHUP, REPLICATION_STANDBY,
gettext_noop("Specifies a file name whose presence ends recovery in the standby."),
- NULL
+ NULL,
+ GUC_NOT_IN_SAMPLE
},
&PromoteTriggerFile,
"",
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