diff options
| author | Tom Lane | 2001-08-26 16:56:03 +0000 |
|---|---|---|
| committer | Tom Lane | 2001-08-26 16:56:03 +0000 |
| commit | bc7d37a525c02f4a0e983854c4222e9d063eeae2 (patch) | |
| tree | 46d1ff8c74eb0a6cec5c183732410a1b846fc5ba /src/include | |
| parent | d1ee78f2962f09f0fe7c6c8ee16ad513ac113ba4 (diff) | |
Transaction IDs wrap around, per my proposal of 13-Aug-01. More
documentation to come, but the code is all here. initdb forced.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/access/transam.h | 13 | ||||
| -rw-r--r-- | src/include/access/xact.h | 3 | ||||
| -rw-r--r-- | src/include/catalog/catversion.h | 4 | ||||
| -rw-r--r-- | src/include/catalog/pg_attribute.h | 6 | ||||
| -rw-r--r-- | src/include/catalog/pg_class.h | 4 | ||||
| -rw-r--r-- | src/include/catalog/pg_database.h | 23 | ||||
| -rw-r--r-- | src/include/catalog/pg_proc.h | 4 | ||||
| -rw-r--r-- | src/include/commands/vacuum.h | 5 | ||||
| -rw-r--r-- | src/include/nodes/parsenodes.h | 3 | ||||
| -rw-r--r-- | src/include/storage/sinval.h | 4 | ||||
| -rw-r--r-- | src/include/utils/tqual.h | 4 |
11 files changed, 43 insertions, 30 deletions
diff --git a/src/include/access/transam.h b/src/include/access/transam.h index f0d213361ac..5ce62d289f9 100644 --- a/src/include/access/transam.h +++ b/src/include/access/transam.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: transam.h,v 1.39 2001/08/25 18:52:42 tgl Exp $ + * $Id: transam.h,v 1.40 2001/08/26 16:56:00 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -31,6 +31,7 @@ #define BootstrapTransactionId ((TransactionId) 1) #define FrozenTransactionId ((TransactionId) 2) #define FirstNormalTransactionId ((TransactionId) 3) +#define MaxTransactionId ((TransactionId) 0xFFFFFFFF) /* ---------------- * transaction ID manipulation macros @@ -38,11 +39,7 @@ */ #define TransactionIdIsValid(xid) ((xid) != InvalidTransactionId) #define TransactionIdIsNormal(xid) ((xid) >= FirstNormalTransactionId) -#define TransactionIdEquals(id1, id2) ((id1) == (id2)) -#define TransactionIdPrecedes(id1, id2) ((id1) < (id2)) -#define TransactionIdPrecedesOrEquals(id1, id2) ((id1) <= (id2)) -#define TransactionIdFollows(id1, id2) ((id1) > (id2)) -#define TransactionIdFollowsOrEquals(id1, id2) ((id1) >= (id2)) +#define TransactionIdEquals(id1, id2) ((id1) == (id2)) #define TransactionIdStore(xid, dest) (*(dest) = (xid)) #define StoreInvalidTransactionId(dest) (*(dest) = InvalidTransactionId) /* advance a transaction ID variable, handling wraparound correctly */ @@ -105,6 +102,10 @@ extern bool TransactionIdDidCommit(TransactionId transactionId); extern bool TransactionIdDidAbort(TransactionId transactionId); extern void TransactionIdCommit(TransactionId transactionId); extern void TransactionIdAbort(TransactionId transactionId); +extern bool TransactionIdPrecedes(TransactionId id1, TransactionId id2); +extern bool TransactionIdPrecedesOrEquals(TransactionId id1, TransactionId id2); +extern bool TransactionIdFollows(TransactionId id1, TransactionId id2); +extern bool TransactionIdFollowsOrEquals(TransactionId id1, TransactionId id2); /* in transam/varsup.c */ extern TransactionId GetNewTransactionId(void); diff --git a/src/include/access/xact.h b/src/include/access/xact.h index a9c7b674a95..55c04351177 100644 --- a/src/include/access/xact.h +++ b/src/include/access/xact.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: xact.h,v 1.35 2001/08/25 18:52:42 tgl Exp $ + * $Id: xact.h,v 1.36 2001/08/26 16:56:00 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -130,5 +130,6 @@ extern void xact_desc(char *buf, uint8 xl_info, char *rec); extern Datum xidin(PG_FUNCTION_ARGS); extern Datum xidout(PG_FUNCTION_ARGS); extern Datum xideq(PG_FUNCTION_ARGS); +extern Datum xid_age(PG_FUNCTION_ARGS); #endif /* XACT_H */ diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 58d43a65293..0b67a37ad22 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -37,7 +37,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: catversion.h,v 1.92 2001/08/25 18:52:42 tgl Exp $ + * $Id: catversion.h,v 1.93 2001/08/26 16:56:00 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 200108241 +#define CATALOG_VERSION_NO 200108251 #endif diff --git a/src/include/catalog/pg_attribute.h b/src/include/catalog/pg_attribute.h index eb1ba77235e..826d2b8ea84 100644 --- a/src/include/catalog/pg_attribute.h +++ b/src/include/catalog/pg_attribute.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: pg_attribute.h,v 1.75 2001/08/25 18:52:42 tgl Exp $ + * $Id: pg_attribute.h,v 1.76 2001/08/26 16:56:00 tgl Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -276,8 +276,10 @@ DATA(insert ( 1262 encoding 23 0 4 3 0 -1 -1 t p f i f f)); DATA(insert ( 1262 datistemplate 16 0 1 4 0 -1 -1 t p f c f f)); DATA(insert ( 1262 datallowconn 16 0 1 5 0 -1 -1 t p f c f f)); DATA(insert ( 1262 datlastsysoid 26 0 4 6 0 -1 -1 t p f i f f)); +DATA(insert ( 1262 datvacuumxid 28 0 4 7 0 -1 -1 t p f i f f)); +DATA(insert ( 1262 datfrozenxid 28 0 4 8 0 -1 -1 t p f i f f)); /* do not mark datpath as toastable; GetRawDatabaseInfo won't cope */ -DATA(insert ( 1262 datpath 25 0 -1 7 0 -1 -1 f p f i f f)); +DATA(insert ( 1262 datpath 25 0 -1 9 0 -1 -1 f p f i f f)); DATA(insert ( 1262 ctid 27 0 6 -1 0 -1 -1 f p f i f f)); DATA(insert ( 1262 oid 26 0 4 -2 0 -1 -1 t p f i f f)); DATA(insert ( 1262 xmin 28 0 4 -3 0 -1 -1 t p f i f f)); diff --git a/src/include/catalog/pg_class.h b/src/include/catalog/pg_class.h index 4f2708e3bd0..2d0103a87b8 100644 --- a/src/include/catalog/pg_class.h +++ b/src/include/catalog/pg_class.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: pg_class.h,v 1.53 2001/08/25 18:52:43 tgl Exp $ + * $Id: pg_class.h,v 1.54 2001/08/26 16:56:01 tgl Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -142,7 +142,7 @@ DATA(insert OID = 1260 ( pg_shadow 86 PGUID 0 1260 0 0 0 0 f t r 8 0 0 0 0 0 DESCR(""); DATA(insert OID = 1261 ( pg_group 87 PGUID 0 1261 0 0 0 0 f t r 3 0 0 0 0 0 f f f f _null_ )); DESCR(""); -DATA(insert OID = 1262 ( pg_database 88 PGUID 0 1262 0 0 0 0 f t r 7 0 0 0 0 0 t f f f _null_ )); +DATA(insert OID = 1262 ( pg_database 88 PGUID 0 1262 0 0 0 0 f t r 9 0 0 0 0 0 t f f f _null_ )); DESCR(""); DATA(insert OID = 376 ( pg_xactlock 0 PGUID 0 0 0 0 0 0 f t s 1 0 0 0 0 0 f f f f _null_ )); DESCR(""); diff --git a/src/include/catalog/pg_database.h b/src/include/catalog/pg_database.h index ffc83da3b4c..f3e0fbd99b7 100644 --- a/src/include/catalog/pg_database.h +++ b/src/include/catalog/pg_database.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: pg_database.h,v 1.17 2001/03/22 04:00:38 momjian Exp $ + * $Id: pg_database.h,v 1.18 2001/08/26 16:56:02 tgl Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -33,13 +33,14 @@ */ CATALOG(pg_database) BOOTSTRAP { - NameData datname; - int4 datdba; - int4 encoding; - bool datistemplate; /* allowed as template for CREATE - * DATABASE? */ + NameData datname; /* database name */ + int4 datdba; /* sysid of owner */ + int4 encoding; /* multibyte encoding, if any */ + bool datistemplate; /* allowed as CREATE DATABASE template? */ bool datallowconn; /* new connections allowed? */ - Oid datlastsysoid; + Oid datlastsysoid; /* highest OID to consider a system OID */ + TransactionId datvacuumxid; /* all XIDs before this are vacuumed */ + TransactionId datfrozenxid; /* all XIDs before this are frozen */ text datpath; /* VARIABLE LENGTH FIELD */ } FormData_pg_database; @@ -54,16 +55,18 @@ typedef FormData_pg_database *Form_pg_database; * compiler constants for pg_database * ---------------- */ -#define Natts_pg_database 7 +#define Natts_pg_database 9 #define Anum_pg_database_datname 1 #define Anum_pg_database_datdba 2 #define Anum_pg_database_encoding 3 #define Anum_pg_database_datistemplate 4 #define Anum_pg_database_datallowconn 5 #define Anum_pg_database_datlastsysoid 6 -#define Anum_pg_database_datpath 7 +#define Anum_pg_database_datvacuumxid 7 +#define Anum_pg_database_datfrozenxid 8 +#define Anum_pg_database_datpath 9 -DATA(insert OID = 1 ( template1 PGUID ENCODING t t 0 "" )); +DATA(insert OID = 1 ( template1 PGUID ENCODING t t 0 0 0 "" )); DESCR("Default template database"); #define TemplateDbOid 1 diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index e2a48dec681..c8919ff6833 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: pg_proc.h,v 1.206 2001/08/16 20:38:54 tgl Exp $ + * $Id: pg_proc.h,v 1.207 2001/08/26 16:56:02 tgl Exp $ * * NOTES * The script catalog/genbki.sh reads this file and generates .bki @@ -1450,6 +1450,8 @@ DATA(insert OID = 1179 ( date PGUID 12 f t f t 1 f 1082 "702" 100 0 0 100 DESCR("convert abstime to date"); DATA(insert OID = 1180 ( abstime PGUID 12 f t f t 1 f 702 "1184" 100 0 0 100 timestamp_abstime - )); DESCR("convert timestamp to abstime"); +DATA(insert OID = 1181 ( age PGUID 12 f t f t 1 f 23 "28" 100 0 0 100 xid_age - )); +DESCR("age of a transaction ID, in transactions before current transaction"); DATA(insert OID = 1188 ( timestamp_mi PGUID 12 f t f t 2 f 1186 "1184 1184" 100 0 0 100 timestamp_mi - )); DESCR("subtract"); diff --git a/src/include/commands/vacuum.h b/src/include/commands/vacuum.h index 0d362bb1801..5d1541ef3ba 100644 --- a/src/include/commands/vacuum.h +++ b/src/include/commands/vacuum.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: vacuum.h,v 1.39 2001/07/18 00:46:25 tgl Exp $ + * $Id: vacuum.h,v 1.40 2001/08/26 16:56:02 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -44,6 +44,9 @@ extern void vac_update_relstats(Oid relid, BlockNumber num_pages, double num_tuples, bool hasindex); +extern void vacuum_set_xid_limits(VacuumStmt *vacstmt, bool sharedRel, + TransactionId *oldestXmin, + TransactionId *freezeLimit); extern bool vac_is_partial_index(Relation indrel); extern void vac_init_rusage(VacRUsage *ru0); extern const char *vac_show_rusage(VacRUsage *ru0); diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index a961cb5af4f..315ad113ee7 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: parsenodes.h,v 1.142 2001/08/21 16:36:06 tgl Exp $ + * $Id: parsenodes.h,v 1.143 2001/08/26 16:56:02 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -694,6 +694,7 @@ typedef struct VacuumStmt bool vacuum; /* do VACUUM step */ bool full; /* do FULL (non-concurrent) vacuum */ bool analyze; /* do ANALYZE step */ + bool freeze; /* early-freeze option */ bool verbose; /* print progress info */ char *vacrel; /* name of single table to process, or NULL */ List *va_cols; /* list of column names, or NIL for all */ diff --git a/src/include/storage/sinval.h b/src/include/storage/sinval.h index 11aad609573..2e1ac7bfb15 100644 --- a/src/include/storage/sinval.h +++ b/src/include/storage/sinval.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: sinval.h,v 1.20 2001/07/06 21:04:26 tgl Exp $ + * $Id: sinval.h,v 1.21 2001/08/26 16:56:02 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -76,7 +76,7 @@ extern void ReceiveSharedInvalidMessages( extern bool DatabaseHasActiveBackends(Oid databaseId, bool ignoreMyself); extern bool TransactionIdIsInProgress(TransactionId xid); -extern void GetXmaxRecent(TransactionId *XmaxRecent); +extern TransactionId GetOldestXmin(bool allDbs); extern int CountActiveBackends(void); /* Use "struct proc", not PROC, to avoid including proc.h here */ extern struct proc *BackendIdGetProc(BackendId procId); diff --git a/src/include/utils/tqual.h b/src/include/utils/tqual.h index bff437f540b..cc238e7457b 100644 --- a/src/include/utils/tqual.h +++ b/src/include/utils/tqual.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: tqual.h,v 1.33 2001/08/23 23:06:38 tgl Exp $ + * $Id: tqual.h,v 1.34 2001/08/26 16:56:03 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -104,7 +104,7 @@ extern bool HeapTupleSatisfiesSnapshot(HeapTupleHeader tuple, Snapshot snapshot); extern int HeapTupleSatisfiesUpdate(HeapTuple tuple); extern HTSV_Result HeapTupleSatisfiesVacuum(HeapTupleHeader tuple, - TransactionId XmaxRecent); + TransactionId OldestXmin); extern Snapshot GetSnapshotData(bool serializable); extern void SetQuerySnapshot(void); |
