mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Remove the "snapshot too old" feature.
Remove the old_snapshot_threshold setting and mechanism for producing
the error "snapshot too old", originally added by commit 848ef42b
.
Unfortunately it had a number of known problems in terms of correctness
and performance, mostly reported by Andres in the course of his work on
snapshot scalability. We agreed to remove it, after a long period
without an active plan to fix it.
This is certainly a desirable feature, and someone might propose a new
or improved implementation in the future.
Reported-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/CACG%3DezYV%2BEvO135fLRdVn-ZusfVsTY6cH1OZqWtezuEYH6ciQA%40mail.gmail.com
Discussion: https://postgr.es/m/20200401064008.qob7bfnnbu4w5cw4%40alap3.anarazel.de
Discussion: https://postgr.es/m/CA%2BTgmoY%3Daqf0zjTD%2B3dUWYkgMiNDegDLFjo%2B6ze%3DWtpik%2B3XqA%40mail.gmail.com
This commit is contained in:
@ -2709,65 +2709,6 @@ include_dir 'conf.d'
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="guc-old-snapshot-threshold" xreflabel="old_snapshot_threshold">
|
||||
<term><varname>old_snapshot_threshold</varname> (<type>integer</type>)
|
||||
<indexterm>
|
||||
<primary><varname>old_snapshot_threshold</varname> configuration parameter</primary>
|
||||
</indexterm>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Sets the minimum amount of time that a query snapshot can be used
|
||||
without risk of a <quote>snapshot too old</quote> error occurring
|
||||
when using the snapshot. Data that has been dead for longer than
|
||||
this threshold is allowed to be vacuumed away. This can help
|
||||
prevent bloat in the face of snapshots which remain in use for a
|
||||
long time. To prevent incorrect results due to cleanup of data which
|
||||
would otherwise be visible to the snapshot, an error is generated
|
||||
when the snapshot is older than this threshold and the snapshot is
|
||||
used to read a page which has been modified since the snapshot was
|
||||
built.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If this value is specified without units, it is taken as minutes.
|
||||
A value of <literal>-1</literal> (the default) disables this feature,
|
||||
effectively setting the snapshot age limit to infinity.
|
||||
This parameter can only be set at server start.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Useful values for production work probably range from a small number
|
||||
of hours to a few days. Small values (such as <literal>0</literal> or
|
||||
<literal>1min</literal>) are only allowed because they may sometimes be
|
||||
useful for testing. While a setting as high as <literal>60d</literal> is
|
||||
allowed, please note that in many workloads extreme bloat or
|
||||
transaction ID wraparound may occur in much shorter time frames.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
When this feature is enabled, freed space at the end of a relation
|
||||
cannot be released to the operating system, since that could remove
|
||||
information needed to detect the <quote>snapshot too old</quote>
|
||||
condition. All space allocated to a relation remains associated with
|
||||
that relation for reuse only within that relation unless explicitly
|
||||
freed (for example, with <command>VACUUM FULL</command>).
|
||||
</para>
|
||||
|
||||
<para>
|
||||
This setting does not attempt to guarantee that an error will be
|
||||
generated under any particular circumstances. In fact, if the
|
||||
correct results can be generated from (for example) a cursor which
|
||||
has materialized a result set, no error will be generated even if the
|
||||
underlying rows in the referenced table have been vacuumed away.
|
||||
Some tables cannot safely be vacuumed early, and so will not be
|
||||
affected by this setting, such as system catalogs. For such tables
|
||||
this setting will neither reduce bloat nor create a possibility
|
||||
of a <quote>snapshot too old</quote> error on scanning.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</sect2>
|
||||
</sect1>
|
||||
@ -4783,16 +4724,6 @@ ANY <replaceable class="parameter">num_sync</replaceable> ( <replaceable class="
|
||||
until it eventually reaches the primary. Standbys make no other use
|
||||
of feedback they receive other than to pass upstream.
|
||||
</para>
|
||||
<para>
|
||||
This setting does not override the behavior of
|
||||
<varname>old_snapshot_threshold</varname> on the primary; a snapshot on the
|
||||
standby which exceeds the primary's age threshold can become invalid,
|
||||
resulting in cancellation of transactions on the standby. This is
|
||||
because <varname>old_snapshot_threshold</varname> is intended to provide an
|
||||
absolute limit on the time which dead rows can contribute to bloat,
|
||||
which would otherwise be violated because of the configuration of a
|
||||
standby.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
@ -150,7 +150,6 @@ CREATE EXTENSION <replaceable>extension_name</replaceable>;
|
||||
&isn;
|
||||
&lo;
|
||||
<ree;
|
||||
&oldsnapshot;
|
||||
&pageinspect;
|
||||
&passwordcheck;
|
||||
&pgbuffercache;
|
||||
|
@ -138,7 +138,6 @@
|
||||
<!ENTITY lo SYSTEM "lo.sgml">
|
||||
<!ENTITY ltree SYSTEM "ltree.sgml">
|
||||
<!ENTITY oid2name SYSTEM "oid2name.sgml">
|
||||
<!ENTITY oldsnapshot SYSTEM "oldsnapshot.sgml">
|
||||
<!ENTITY pageinspect SYSTEM "pageinspect.sgml">
|
||||
<!ENTITY passwordcheck SYSTEM "passwordcheck.sgml">
|
||||
<!ENTITY pgbuffercache SYSTEM "pgbuffercache.sgml">
|
||||
|
@ -1,33 +0,0 @@
|
||||
<!-- doc/src/sgml/oldsnapshot.sgml -->
|
||||
|
||||
<sect1 id="oldsnapshot" xreflabel="old_snapshot">
|
||||
<title>old_snapshot — inspect <literal>old_snapshot_threshold</literal> state</title>
|
||||
|
||||
<indexterm zone="oldsnapshot">
|
||||
<primary>old_snapshot</primary>
|
||||
</indexterm>
|
||||
|
||||
<para>
|
||||
The <filename>old_snapshot</filename> module allows inspection
|
||||
of the server state that is used to implement
|
||||
<xref linkend="guc-old-snapshot-threshold" />.
|
||||
</para>
|
||||
|
||||
<sect2 id="oldsnapshot-functions">
|
||||
<title>Functions</title>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><function>pg_old_snapshot_time_mapping(array_offset OUT int4, end_timestamp OUT timestamptz, newest_xmin OUT xid) returns setof record</function></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Returns all of the entries in the server's timestamp to XID mapping.
|
||||
Each entry represents the newest xmin of any snapshot taken in the
|
||||
corresponding minute.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</sect2>
|
||||
|
||||
</sect1>
|
Reference in New Issue
Block a user