postgresql/src/include
Peter Geoghegan c3ffa731a5 Derive freeze cutoff from nextXID, not OldestXmin.
Before now, the cutoffs that VACUUM used to determine which XIDs/MXIDs
to freeze were determined at the start of each VACUUM by taking related
cutoffs that represent which XIDs/MXIDs VACUUM should treat as still
running, and subtracting an XID/MXID age based value controlled by GUCs
like vacuum_freeze_min_age.  The FreezeLimit cutoff (XID freeze cutoff)
was derived by subtracting an XID age value from OldestXmin, while the
MultiXactCutoff cutoff (MXID freeze cutoff) was derived by subtracting
an MXID age value from OldestMxact.  This approach didn't match the
approach used nearby to determine whether this VACUUM operation should
be an aggressive VACUUM or not.

VACUUM now uses the standard approach instead: it subtracts the same
age-based values from next XID/next MXID (rather than subtracting from
OldestXmin/OldestMxact).  This approach is simpler and more uniform.
Most of the time it will have only a negligible impact on how and when
VACUUM freezes.  It will occasionally make VACUUM more robust in the
event of problems caused by long running transaction.  These are cases
where OldestXmin and OldestMxact are held back by so much that they
attain an age that is a significant fraction of the value of age-based
settings like vacuum_freeze_min_age.

There is no principled reason why freezing should be affected in any way
by the presence of a long-running transaction -- at least not before the
point that the OldestXmin and OldestMxact limits used by each VACUUM
operation attain an age that makes it unsafe to freeze some of the
XIDs/MXIDs whose age exceeds the value of the relevant age-based
settings.  The new approach should at least make freezing degrade more
gracefully than before, even in the most extreme cases.

Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-By: Matthias van de Meent <boekewurm+postgres@gmail.com>
Discussion: https://postgr.es/m/CAH2-WzkOv5CEeyOO=c91XnT5WBR_0gii0Wn5UbZhJ=4TTykDYg@mail.gmail.com
2022-08-31 11:37:35 -07:00
..
access Update the comment in rmgrlist.h to match it to the code. 2022-08-30 09:16:41 +05:30
backup Move basebackup code to new directory src/backend/backup 2022-08-10 14:03:23 -04:00
bootstrap Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
catalog Allow grant-level control of role inheritance behavior. 2022-08-25 10:06:02 -04:00
commands Derive freeze cutoff from nextXID, not OldestXmin. 2022-08-31 11:37:35 -07:00
common Remove replacement code for getaddrinfo. 2022-08-14 09:53:28 +12:00
datatype Fix overflow hazards in interval input and output conversions. 2022-04-02 16:12:29 -04:00
executor Remove unused fields from ExprEvalStep 2022-08-03 09:46:02 +12:00
fe_utils Add xheader_width pset option to psql 2022-07-25 14:25:02 -04:00
foreign Update copyright for 2022 2022-01-07 19:04:57 -05:00
jit Add central declarations for dlsym()ed symbols 2022-07-17 17:23:42 -07:00
lib Add missing inequality searches to rbtree 2022-07-08 22:00:03 +03:00
libpq Allow parallel workers to retrieve some data from Port 2022-08-24 12:57:13 +09:00
mb Use SSE2 in is_valid_ascii() where available. 2022-08-26 15:48:49 +07:00
nodes Improve performance of and reduce overheads of memory management 2022-08-29 17:15:00 +12:00
optimizer Improve performance of adjust_appendrel_attrs_multilevel. 2022-08-18 12:36:16 -04:00
parser Update comment in gramparse.h 2022-08-18 09:45:05 +07:00
partitioning Have ExecFindPartition cache the last found partition 2022-08-02 09:55:27 +12:00
port Further code review of port/simd.h 2022-08-30 09:50:00 +07:00
portability Fix obsolete comments in instr_time.h. 2022-08-09 11:50:03 +12:00
postmaster Add central declarations for dlsym()ed symbols 2022-07-17 17:23:42 -07:00
regex Remove configure probe for wctype.h. 2022-07-23 16:54:00 +12:00
replication Fix comment in walsender_private.h 2022-08-22 10:02:53 +09:00
rewrite Update copyright for 2022 2022-01-07 19:04:57 -05:00
snowball Update copyright for 2022 2022-01-07 19:04:57 -05:00
statistics Add stxdinherit flag to pg_statistic_ext_data 2022-01-16 13:38:01 +01:00
storage Remove unused symbol __aarch64 2022-08-25 13:37:40 +07:00
tcop Allow event trigger table_rewrite for ALTER MATERIALIZED VIEW 2022-08-17 14:55:20 +09:00
tsearch Remove configure probe for wctype.h. 2022-07-23 16:54:00 +12:00
utils Various cleanups of the new memory context header code 2022-08-31 07:33:54 +12:00
.gitignore Refactor dlopen() support 2018-09-06 11:33:04 +02:00
c.h Move NON_EXEC_STATIC from c.h to postgres.h 2022-08-25 15:07:03 +02:00
fmgr.h Mark all symbols exported from extension libraries PGDLLEXPORT. 2022-07-17 18:50:14 -07:00
funcapi.h Create routine able to set single-call SRFs for Materialize mode 2022-03-07 10:26:29 +09:00
getopt_long.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
Makefile Install generated nodes/nodetags.h 2022-07-09 10:20:23 +02:00
miscadmin.h Allow parallel workers to retrieve some data from Port 2022-08-24 12:57:13 +09:00
pg_config_ext.h.in Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_manual.h Remove our artificial PG_SOMAXCONN limit on listen queue length. 2022-08-23 10:15:06 -04:00
pg_config.h.in Remove configure probe for sockaddr_in6 and require AF_INET6. 2022-08-26 10:18:30 +12:00
pg_getopt.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
pg_trace.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
pgstat.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
pgtar.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
pgtime.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
port.h Remove HAVE_UNIX_SOCKETS. 2022-08-14 08:46:53 +12:00
postgres_ext.h Change internal RelFileNode references to RelFileNumber or RelFileLocator. 2022-07-06 11:39:09 -04:00
postgres_fe.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
postgres.h Move NON_EXEC_STATIC from c.h to postgres.h 2022-08-25 15:07:03 +02:00
windowapi.h Update copyright for 2022 2022-01-07 19:04:57 -05:00