Track the current XID wrap limit (or more accurately, the oldest unfrozen
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 31 Aug 2009 02:23:23 +0000 (02:23 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 31 Aug 2009 02:23:23 +0000 (02:23 +0000)
commit186b10c1f0a61f90d320a4ccce2ff8b31fa55210
tree2b7b0aec2e69a1d42941f27959cd2b57e9d2f63b
parent8cf291106b7145294e87eabd936e833aa6d8c7b6
Track the current XID wrap limit (or more accurately, the oldest unfrozen
XID) in checkpoint records.  This eliminates the need to recompute the value
from scratch during database startup, which is one of the two remaining
reasons for the flatfile code to exist.  It should also simplify life for
hot-standby operation.

To avoid bloating the checkpoint records unreasonably, I switched from
tracking the oldest database by name to tracking it by OID.  This turns
out to save cycles in general (everywhere but the warning-generating
paths, which we hardly care about) and also helps us deal with the case
that the oldest database got dropped instead of being vacuumed.  The prior
coding might go for a long time without updating the wrap limit in that case,
which is bad because it might result in a lot of useless autovacuum activity.
src/backend/access/transam/varsup.c
src/backend/access/transam/xlog.c
src/backend/commands/vacuum.c
src/backend/utils/init/flatfiles.c
src/backend/utils/misc/guc.c
src/bin/pg_controldata/pg_controldata.c
src/bin/pg_resetxlog/pg_resetxlog.c
src/include/access/transam.h
src/include/catalog/pg_control.h