Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit aceedd8

Browse files
committed
Make vacuum_defer_cleanup_age be PGC_SIGHUP level, since it's not sensible
to have different values in different processes of the primary server. Also put it into the "Streaming Replication" GUC category; it doesn't belong in "Standby Servers" because you use it on the master not the standby. In passing also correct guc.c's idea of wal_keep_segments' category.
1 parent e76c1a0 commit aceedd8

File tree

4 files changed

+41
-31
lines changed

4 files changed

+41
-31
lines changed

doc/src/sgml/config.sgml

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.289 2010/07/03 20:43:57 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.290 2010/07/03 21:23:58 tgl Exp $ -->
22

33
<chapter Id="runtime-config">
44
<title>Server Configuration</title>
@@ -1914,6 +1914,31 @@ SET ENABLE_SEQSCAN TO OFF;
19141914
</para>
19151915
</listitem>
19161916
</varlistentry>
1917+
1918+
<varlistentry id="guc-vacuum-defer-cleanup-age" xreflabel="vacuum_defer_cleanup_age">
1919+
<term><varname>vacuum_defer_cleanup_age</varname> (<type>integer</type>)</term>
1920+
<indexterm>
1921+
<primary><varname>vacuum_defer_cleanup_age</> configuration parameter</primary>
1922+
</indexterm>
1923+
<listitem>
1924+
<para>
1925+
Specifies the number of transactions by which <command>VACUUM</> and
1926+
<acronym>HOT</> updates will defer cleanup of dead row versions. The
1927+
default is zero transactions, meaning that dead row versions can be
1928+
removed as soon as possible, that is, as soon as they are no longer
1929+
visible to any open transaction. You may wish to set this to a
1930+
non-zero value on a primary server that is supporting hot standby
1931+
servers, as described in <xref linkend="hot-standby">. This allows
1932+
more time for queries on the standby to complete without incurring
1933+
conflicts due to early cleanup of rows. However, since the value
1934+
is measured in terms of number of write transactions occurring on the
1935+
primary server, it is difficult to predict just how much additional
1936+
grace time will be made available to standby queries.
1937+
This parameter can only be set in the <filename>postgresql.conf</>
1938+
file or on the server command line.
1939+
</para>
1940+
</listitem>
1941+
</varlistentry>
19171942
</variablelist>
19181943
</sect2>
19191944

@@ -2004,29 +2029,6 @@ SET ENABLE_SEQSCAN TO OFF;
20042029
</listitem>
20052030
</varlistentry>
20062031

2007-
<varlistentry id="guc-vacuum-defer-cleanup-age" xreflabel="vacuum_defer_cleanup_age">
2008-
<term><varname>vacuum_defer_cleanup_age</varname> (<type>integer</type>)</term>
2009-
<indexterm>
2010-
<primary><varname>vacuum_defer_cleanup_age</> configuration parameter</primary>
2011-
</indexterm>
2012-
<listitem>
2013-
<para>
2014-
Specifies the number of transactions by which <command>VACUUM</> and
2015-
<acronym>HOT</> updates will defer cleanup of dead row versions. The
2016-
default is 0 transactions, meaning that dead row versions will be
2017-
removed as soon as possible. You may wish to set this to a non-zero
2018-
value when planning or maintaining a Hot Standby connection, as
2019-
described in <xref linkend="hot-standby">. The recommended value is
2020-
<literal>0</> unless you have clear reason to increase it. The purpose
2021-
of the parameter is to allow the user to specify an approximate time
2022-
delay before cleanup occurs. However, it should be noted that there is
2023-
no direct link with any specific time delay and so the results will be
2024-
application and installation specific, as well as variable over time,
2025-
depending upon the transaction rate (of writes only).
2026-
</para>
2027-
</listitem>
2028-
</varlistentry>
2029-
20302032
</variablelist>
20312033
</sect2>
20322034
</sect1>

src/backend/storage/ipc/procarray.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.70 2010/05/14 07:11:49 sriggs Exp $
40+
* $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.71 2010/07/03 21:23:58 tgl Exp $
4141
*
4242
*-------------------------------------------------------------------------
4343
*/
@@ -1117,7 +1117,15 @@ GetOldestXmin(bool allDbs, bool ignoreVacuum)
11171117
LWLockRelease(ProcArrayLock);
11181118

11191119
/*
1120-
* Compute the cutoff XID, being careful not to generate a "permanent" XID
1120+
* Compute the cutoff XID, being careful not to generate a "permanent" XID.
1121+
*
1122+
* vacuum_defer_cleanup_age provides some additional "slop" for the
1123+
* benefit of hot standby queries on slave servers. This is quick and
1124+
* dirty, and perhaps not all that useful unless the master has a
1125+
* predictable transaction rate, but it's what we've got. Note that
1126+
* we are assuming vacuum_defer_cleanup_age isn't large enough to cause
1127+
* wraparound --- so guc.c should limit it to no more than the xidStopLimit
1128+
* threshold in varsup.c.
11211129
*/
11221130
result -= vacuum_defer_cleanup_age;
11231131
if (!TransactionIdIsNormal(result))

src/backend/utils/misc/guc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.558 2010/07/03 20:43:58 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.559 2010/07/03 21:23:58 tgl Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -1631,8 +1631,8 @@ static struct config_int ConfigureNamesInt[] =
16311631
},
16321632

16331633
{
1634-
{"vacuum_defer_cleanup_age", PGC_USERSET, WAL_STANDBY_SERVERS,
1635-
gettext_noop("Age by which VACUUM and HOT cleanup should be deferred, if any."),
1634+
{"vacuum_defer_cleanup_age", PGC_SIGHUP, WAL_REPLICATION,
1635+
gettext_noop("Number of transactions by which VACUUM and HOT cleanup should be deferred, if any."),
16361636
NULL
16371637
},
16381638
&vacuum_defer_cleanup_age,
@@ -1675,7 +1675,7 @@ static struct config_int ConfigureNamesInt[] =
16751675
},
16761676

16771677
{
1678-
{"wal_keep_segments", PGC_SIGHUP, WAL_CHECKPOINTS,
1678+
{"wal_keep_segments", PGC_SIGHUP, WAL_REPLICATION,
16791679
gettext_noop("Sets the number of WAL files held for standby servers."),
16801680
NULL
16811681
},

src/backend/utils/misc/postgresql.conf.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@
188188
#max_wal_senders = 0 # max number of walsender processes
189189
#wal_sender_delay = 200ms # walsender cycle time, 1-10000 milliseconds
190190
#wal_keep_segments = 0 # in logfile segments, 16MB each; 0 disables
191+
#vacuum_defer_cleanup_age = 0 # number of xacts by which cleanup is delayed
191192

192193
# - Standby Servers -
193194

@@ -198,7 +199,6 @@
198199
#max_standby_streaming_delay = 30s # max delay before canceling queries
199200
# when reading streaming WAL;
200201
# -1 allows indefinite delay
201-
#vacuum_defer_cleanup_age = 0 # number of transactions by which cleanup is deferred
202202

203203

204204
#------------------------------------------------------------------------------

0 commit comments

Comments
 (0)