postgresql/src/backend
Peter Geoghegan 1e55e7d175 Add wraparound failsafe to VACUUM.
Add a failsafe mechanism that is triggered by VACUUM when it notices
that the table's relfrozenxid and/or relminmxid are dangerously far in
the past.  VACUUM checks the age of the table dynamically, at regular
intervals.

When the failsafe triggers, VACUUM takes extraordinary measures to
finish as quickly as possible so that relfrozenxid and/or relminmxid can
be advanced.  VACUUM will stop applying any cost-based delay that may be
in effect.  VACUUM will also bypass any further index vacuuming and heap
vacuuming -- it only completes whatever remaining pruning and freezing
is required.  Bypassing index/heap vacuuming is enabled by commit
8523492d, which made it possible to dynamically trigger the mechanism
already used within VACUUM when it is run with INDEX_CLEANUP off.

It is expected that the failsafe will almost always trigger within an
autovacuum to prevent wraparound, long after the autovacuum began.
However, the failsafe mechanism can trigger in any VACUUM operation.
Even in a non-aggressive VACUUM, where we're likely to not advance
relfrozenxid, it still seems like a good idea to finish off remaining
pruning and freezing.   An aggressive/anti-wraparound VACUUM will be
launched immediately afterwards.  Note that the anti-wraparound VACUUM
that follows will itself trigger the failsafe, usually before it even
begins its first (and only) pass over the heap.

The failsafe is controlled by two new GUCs: vacuum_failsafe_age, and
vacuum_multixact_failsafe_age.  There are no equivalent reloptions,
since that isn't expected to be useful.  The GUCs have rather high
defaults (both default to 1.6 billion), and are expected to generally
only be used to make the failsafe trigger sooner/more frequently.

Author: Masahiko Sawada <sawada.mshk@gmail.com>
Author: Peter Geoghegan <pg@bowt.ie>
Discussion: https://postgr.es/m/CAD21AoD0SkE11fMw4jD4RENAwBMcw1wasVnwpJVw3tVqPOQgAw@mail.gmail.com
Discussion: https://postgr.es/m/CAH2-WzmgH3ySGYeC-m-eOBsa2=sDwa292-CFghV4rESYo39FsQ@mail.gmail.com
2021-04-07 12:37:45 -07:00
..
access Add wraparound failsafe to VACUUM. 2021-04-07 12:37:45 -07:00
bootstrap Split backend status and progress related functionality out of pgstat.c. 2021-04-03 11:42:52 -07:00
catalog Make use of in-core query id added by commit 5fd9dfa5f5 2021-04-07 14:04:06 -04:00
commands Add wraparound failsafe to VACUUM. 2021-04-07 12:37:45 -07:00
executor Make use of in-core query id added by commit 5fd9dfa5f5 2021-04-07 14:04:06 -04:00
foreign Update copyright for 2021 2021-01-02 13:06:25 -05:00
jit Use errmsg_internal for debug messages 2021-02-17 11:33:25 +01:00
lib Update copyright for 2021 2021-01-02 13:06:25 -05:00
libpq Refactor hba_authname 2021-04-07 14:24:47 +02:00
main Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodes Add Result Cache executor node (take 2) 2021-04-02 14:10:56 +13:00
optimizer Add support for NullIfExpr in eval_const_expressions 2021-04-02 11:01:49 +02:00
parser Make use of in-core query id added by commit 5fd9dfa5f5 2021-04-07 14:04:06 -04:00
partitioning ALTER TABLE ... DETACH PARTITION ... CONCURRENTLY 2021-03-25 18:00:28 -03:00
po Translation updates 2020-05-18 12:49:30 +02:00
port Use errmsg_internal for debug messages 2021-02-17 11:33:25 +01:00
postmaster Fix typo in pgstat.c. 2021-04-06 14:09:40 +09:00
regex Further tweak memory management for regex DFAs. 2021-03-08 16:32:29 -05:00
replication Message improvement 2021-04-07 07:42:44 +02:00
rewrite Clean up treatment of missing default and CHECK-constraint records. 2021-04-06 10:34:39 -04:00
snowball Update snowball 2021-02-19 08:10:15 +01:00
statistics Fix handling of clauses incompatible with extended statistics 2021-04-06 16:56:06 +02:00
storage Truncate line pointer array during VACUUM. 2021-04-07 08:47:15 -07:00
tcop Make use of in-core query id added by commit 5fd9dfa5f5 2021-04-07 14:04:06 -04:00
tsearch Don't leak compiled regex(es) when an ispell cache entry is dropped. 2021-03-18 22:22:47 -04:00
utils Add wraparound failsafe to VACUUM. 2021-04-07 12:37:45 -07:00
.gitignore
Makefile Use sort_template.h for qsort_tuple() and qsort_ssup(). 2021-03-03 17:02:32 +13:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
nls.mk Add missing gettext triggers 2020-04-28 13:35:40 +02:00