Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorSimon Riggs2011-02-16 19:29:37 +0000
committerSimon Riggs2011-02-16 19:29:37 +0000
commitbca8b7f16a3e720794cb0afbdb3733be4f8d9c2c (patch)
tree4d2e650f058ffa99af77f9068bf64a223de17246 /doc
parent65076269ea54a8cd6e39f066a208c7d13aceac0a (diff)
Hot Standby feedback for avoidance of cleanup conflicts on standby.
Standby optionally sends back information about oldestXmin of queries which is then checked and applied to the WALSender's proc->xmin. GetOldestXmin() is modified slightly to agree with GetSnapshotData(), so that all backends on primary include WALSender within their snapshots. Note this does nothing to change the snapshot xmin on either master or standby. Feedback piggybacks on the standby reply message. vacuum_defer_cleanup_age is no longer used on standby, though parameter still exists on primary, since some use cases still exist. Simon Riggs, review comments from Fujii Masao, Heikki Linnakangas, Robert Haas
Diffstat (limited to 'doc')
-rw-r--r--doc/src/sgml/config.sgml20
-rw-r--r--doc/src/sgml/high-availability.sgml44
2 files changed, 41 insertions, 23 deletions
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 9505caf47a2..cee09c76815 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -2006,6 +2006,10 @@ SET ENABLE_SEQSCAN TO OFF;
This parameter can only be set in the <filename>postgresql.conf</>
file or on the server command line.
</para>
+ <para>
+ You should also consider setting <varname>hot_standby_feedback</>
+ as an alternative to using this parameter.
+ </para>
</listitem>
</varlistentry>
</variablelist>
@@ -2121,6 +2125,22 @@ SET ENABLE_SEQSCAN TO OFF;
</listitem>
</varlistentry>
+ <varlistentry id="guc-hot-standby-feedback" xreflabel="hot_standby">
+ <term><varname>hot_standby_feedback</varname> (<type>boolean</type>)</term>
+ <indexterm>
+ <primary><varname>hot_standby_feedback</> configuration parameter</primary>
+ </indexterm>
+ <listitem>
+ <para>
+ Specifies whether or not a hot standby will send feedback to the primary
+ about queries currently executing on the standby. This parameter can
+ be used to eliminate query cancels caused by cleanup records, though
+ it can cause database bloat on the primary for some workloads.
+ The default value is <literal>off</literal>.
+ </para>
+ </listitem>
+ </varlistentry>
+
</variablelist>
</sect2>
</sect1>
diff --git a/doc/src/sgml/high-availability.sgml b/doc/src/sgml/high-availability.sgml
index 368c68867af..37ba43b5fd7 100644
--- a/doc/src/sgml/high-availability.sgml
+++ b/doc/src/sgml/high-availability.sgml
@@ -1484,23 +1484,6 @@ if (!triggered)
</para>
<para>
- The most common reason for conflict between standby queries and WAL replay
- is <quote>early cleanup</>. Normally, <productname>PostgreSQL</> allows
- cleanup of old row versions when there are no transactions that need to
- see them to ensure correct visibility of data according to MVCC rules.
- However, this rule can only be applied for transactions executing on the
- master. So it is possible that cleanup on the master will remove row
- versions that are still visible to a transaction on the standby.
- </para>
-
- <para>
- Experienced users should note that both row version cleanup and row version
- freezing will potentially conflict with standby queries. Running a manual
- <command>VACUUM FREEZE</> is likely to cause conflicts even on tables with
- no updated or deleted rows.
- </para>
-
- <para>
Once the delay specified by <varname>max_standby_archive_delay</> or
<varname>max_standby_streaming_delay</> has been exceeded, conflicting
queries will be cancelled. This usually results just in a cancellation
@@ -1527,6 +1510,23 @@ if (!triggered)
</para>
<para>
+ The most common reason for conflict between standby queries and WAL replay
+ is <quote>early cleanup</>. Normally, <productname>PostgreSQL</> allows
+ cleanup of old row versions when there are no transactions that need to
+ see them to ensure correct visibility of data according to MVCC rules.
+ However, this rule can only be applied for transactions executing on the
+ master. So it is possible that cleanup on the master will remove row
+ versions that are still visible to a transaction on the standby.
+ </para>
+
+ <para>
+ Experienced users should note that both row version cleanup and row version
+ freezing will potentially conflict with standby queries. Running a manual
+ <command>VACUUM FREEZE</> is likely to cause conflicts even on tables with
+ no updated or deleted rows.
+ </para>
+
+ <para>
Users should be clear that tables that are regularly and heavily updated
on the primary server will quickly cause cancellation of longer running
queries on the standby. In such cases the setting of a finite value for
@@ -1537,12 +1537,10 @@ if (!triggered)
<para>
Remedial possibilities exist if the number of standby-query cancellations
- is found to be unacceptable. The first option is to connect to the
- primary server and keep a query active for as long as needed to
- run queries on the standby. This prevents <command>VACUUM</> from removing
- recently-dead rows and so cleanup conflicts do not occur.
- This could be done using <xref linkend="dblink"> and
- <function>pg_sleep()</>, or via other mechanisms. If you do this, you
+ is found to be unacceptable. The first option is to set the parameter
+ <varname>hot_standby_feedback</>, which prevents <command>VACUUM</> from
+ removing recently-dead rows and so cleanup conflicts do not occur.
+ If you do this, you
should note that this will delay cleanup of dead rows on the primary,
which may result in undesirable table bloat. However, the cleanup
situation will be no worse than if the standby queries were running