pg_resetxlog: add option to set oldest xid & use by pg_upgrade
authorBruce Momjian <bruce@momjian.us>
Tue, 27 Jul 2021 02:38:14 +0000 (22:38 -0400)
committerBruce Momjian <bruce@momjian.us>
Tue, 27 Jul 2021 02:38:14 +0000 (22:38 -0400)
commit0a5e708e2bd87adb0779d7c8758e5743cc1c0adf
treedaa4b3447aa38d93a87ea6d70f0b0238296c5633
parent882d15144bbb21856676ff046faee1e9a580e3e4
pg_resetxlog:  add option to set oldest xid & use by pg_upgrade

Add pg_resetxlog -u option to set the oldest xid in pg_control.
Previously -x set this value be -2 billion less than the -x value.
However, this causes the server to immediately scan all relation's
relfrozenxid so it can advance pg_control's oldest xid to be inside the
autovacuum_freeze_max_age range, which is inefficient and might disrupt
diagnostic recovery.  pg_upgrade will use this option to better create
the new cluster to match the old cluster.

Reported-by: Jason Harvey, Floris Van Nee
Discussion: https://postgr.es/m/20190615183759.GB239428@rfd.leadboat.com, 87da83168c644fd9aae38f546cc70295@opammb0562.comp.optiver.com

Author: Bertrand Drouvot

Backpatch-through: 9.6
doc/src/sgml/ref/pg_resetwal.sgml
src/bin/pg_resetwal/pg_resetwal.c
src/bin/pg_upgrade/controldata.c
src/bin/pg_upgrade/pg_upgrade.c
src/bin/pg_upgrade/pg_upgrade.h