From: | alvherre(at)postgresql(dot)org (Alvaro Herrera) |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Initialize the minimum frozen Xid in vac_update_datfrozenxid |
Date: | 2008-09-11 14:01:10 |
Message-ID: | 20080911140110.10C6D7545A3@cvs.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Log Message:
-----------
Initialize the minimum frozen Xid in vac_update_datfrozenxid using
GetOldestXmin() instead of RecentGlobalXmin; this is safer because we do not
depend on the latter being correctly set elsewhere, and while it is more
expensive, this code path is not performance-critical. This is a real
risk for autovacuum, because it can execute whole cycles without doing
a single vacuum, which would mean that RecentGlobalXmin would stay at its
initialization value, FirstNormalTransactionId, causing a bogus value to be
inserted in pg_database. This bug could explain some recent reports of
failure to truncate pg_clog.
At the same time, change the initialization of RecentGlobalXmin to
InvalidTransactionId, and ensure that it's set to something else whenever
it's going to be used. Using it as FirstNormalTransactionId in HOT page
pruning could incur in data loss. InitPostgres takes care of setting it
to a valid value, but the extra checks are there to prevent "special"
backends from behaving in unusual ways.
Per Tom Lane's detailed problem dissection in 29544(dot)1221061979(at)sss(dot)pgh(dot)pa(dot)us
Modified Files:
--------------
pgsql/src/backend/access/heap:
heapam.c (r1.262 -> r1.263)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/heap/heapam.c?r1=1.262&r2=1.263)
pgsql/src/backend/access/index:
indexam.c (r1.109 -> r1.110)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/index/indexam.c?r1=1.109&r2=1.110)
pgsql/src/backend/commands:
vacuum.c (r1.376 -> r1.377)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/vacuum.c?r1=1.376&r2=1.377)
pgsql/src/backend/executor:
nodeBitmapHeapscan.c (r1.29 -> r1.30)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/nodeBitmapHeapscan.c?r1=1.29&r2=1.30)
pgsql/src/backend/utils/init:
postinit.c (r1.184 -> r1.185)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/init/postinit.c?r1=1.184&r2=1.185)
pgsql/src/backend/utils/time:
snapmgr.c (r1.4 -> r1.5)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/time/snapmgr.c?r1=1.4&r2=1.5)
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2008-09-11 14:01:16 | pgsql: Initialize the minimum frozen Xid in vac_update_datfrozenxid |
Previous Message | User Mkz | 2008-09-11 12:53:33 | plproxy - plproxy: dont crash on nameless input arguments |