OSDN Git Service

Add code to prevent transaction ID wraparound by enforcing a safe limit
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 20 Feb 2005 02:22:07 +0000 (02:22 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 20 Feb 2005 02:22:07 +0000 (02:22 +0000)
commit60b2444cc3ba037630c9b940c3c9ef01b954b87b
tree801836d707d7b2af3367b9a4fa768a44d2530a1e
parent617d16f4ff4959b1615cc9f57e271629c000ccff
Add code to prevent transaction ID wraparound by enforcing a safe limit
in GetNewTransactionId().  Since the limit value has to be computed
before we run any real transactions, this requires adding code to database
startup to scan pg_database and determine the oldest datfrozenxid.
This can conveniently be combined with the first stage of an attack on
the problem that the 'flat file' copies of pg_shadow and pg_group are
not properly updated during WAL recovery.  The code I've added to
startup resides in a new file src/backend/utils/init/flatfiles.c, and
it is responsible for rewriting the flat files as well as initializing
the XID wraparound limit value.  This will eventually allow us to get
rid of GetRawDatabaseInfo too, but we'll need an initdb so we can add
a trigger to pg_database.
15 files changed:
doc/src/sgml/maintenance.sgml
src/backend/access/transam/varsup.c
src/backend/access/transam/xact.c
src/backend/bootstrap/bootstrap.c
src/backend/commands/dbcommands.c
src/backend/commands/user.c
src/backend/commands/vacuum.c
src/backend/libpq/hba.c
src/backend/postmaster/postmaster.c
src/backend/tcop/postgres.c
src/backend/utils/init/Makefile
src/backend/utils/init/flatfiles.c [new file with mode: 0644]
src/include/access/transam.h
src/include/commands/user.h
src/include/utils/flatfiles.h [new file with mode: 0644]