aboutsummaryrefslogtreecommitdiff
path: root/src/include/access/transam.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2009-08-31 02:23:23 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2009-08-31 02:23:23 +0000
commit25ec228ef760eb91c094cc3b6dea7257cc22ffb5 (patch)
tree59d9d82fa2a61c1c27174d9b2f462536a7db39ee /src/include/access/transam.h
parente1cc64197bd3a8d6fd5e4ca6830d514130f2737f (diff)
downloadpostgresql-25ec228ef760eb91c094cc3b6dea7257cc22ffb5.tar.gz
postgresql-25ec228ef760eb91c094cc3b6dea7257cc22ffb5.zip
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.
Diffstat (limited to 'src/include/access/transam.h')
-rw-r--r--src/include/access/transam.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/include/access/transam.h b/src/include/access/transam.h
index b23a663c53a..87609e6f81c 100644
--- a/src/include/access/transam.h
+++ b/src/include/access/transam.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/transam.h,v 1.68 2009/05/08 03:21:35 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/access/transam.h,v 1.69 2009/08/31 02:23:23 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -90,7 +90,7 @@
* just one struct with different fields that are protected by different
* LWLocks.
*
- * Note: xidWrapLimit and limit_datname are not "active" values, but are
+ * Note: xidWrapLimit and oldestXidDB are not "active" values, but are
* used just to generate useful messages when xidWarnLimit or xidStopLimit
* are exceeded.
*/
@@ -112,7 +112,7 @@ typedef struct VariableCacheData
TransactionId xidWarnLimit; /* start complaining here */
TransactionId xidStopLimit; /* refuse to advance nextXid beyond here */
TransactionId xidWrapLimit; /* where the world ends */
- NameData limit_datname; /* database that needs vacuumed first */
+ Oid oldestXidDB; /* database with minimum datfrozenxid */
/*
* These fields are protected by ProcArrayLock.
@@ -155,7 +155,8 @@ extern XLogRecPtr TransactionIdGetCommitLSN(TransactionId xid);
extern TransactionId GetNewTransactionId(bool isSubXact);
extern TransactionId ReadNewTransactionId(void);
extern void SetTransactionIdLimit(TransactionId oldest_datfrozenxid,
- Name oldest_datname);
+ Oid oldest_datoid);
+extern bool TransactionIdLimitIsValid(void);
extern Oid GetNewObjectId(void);
#endif /* TRAMSAM_H */