diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2001-07-12 04:11:13 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2001-07-12 04:11:13 +0000 |
commit | b9f3a929ee6b0309c50d837f464da7440303d2ef (patch) | |
tree | c3bd00b8b62a92bbfaf834dda3342df6f90453c6 /src/backend/access/transam/transam.c | |
parent | eaafc9d66c3196bd0d47cef2b0d8c2cafad504f3 (diff) | |
download | postgresql-b9f3a929ee6b0309c50d837f464da7440303d2ef.tar.gz postgresql-b9f3a929ee6b0309c50d837f464da7440303d2ef.zip |
Create a new HeapTupleSatisfiesVacuum() routine in tqual.c that embodies the
validity checking rules for VACUUM. Make some other rearrangements of the
VACUUM code to allow more code to be shared between full and lazy VACUUM.
Minor code cleanups and added comments for TransactionId manipulations.
Diffstat (limited to 'src/backend/access/transam/transam.c')
-rw-r--r-- | src/backend/access/transam/transam.c | 40 |
1 files changed, 8 insertions, 32 deletions
diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c index 89a35b2d335..910042fb624 100644 --- a/src/backend/access/transam/transam.c +++ b/src/backend/access/transam/transam.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.44 2001/05/14 20:30:19 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.45 2001/07/12 04:11:13 tgl Exp $ * * NOTES * This file contains the high level access-method interface to the @@ -24,6 +24,7 @@ #include "catalog/catname.h" #include "miscadmin.h" + static int RecoveryCheckingEnabled(void); static void TransRecover(Relation logRelation); static bool TransactionLogTest(TransactionId transactionId, XidStatus status); @@ -40,29 +41,11 @@ static void TransactionLogUpdate(TransactionId transactionId, Relation LogRelation = (Relation) NULL; /* ---------------- - * global variables holding cached transaction id's and statuses. - * ---------------- - */ -TransactionId cachedTestXid; -XidStatus cachedTestXidStatus; - -/* ---------------- - * transaction system constants + * Single-item cache for results of TransactionLogTest. * ---------------- */ -/* ---------------------------------------------------------------- - * transaction system constants - * - * read the comments for GetNewTransactionId in order to - * understand the initial values for AmiTransactionId and - * FirstTransactionId. -cim 3/23/90 - * ---------------------------------------------------------------- - */ -TransactionId NullTransactionId = (TransactionId) 0; - -TransactionId AmiTransactionId = (TransactionId) 512; - -TransactionId FirstTransactionId = (TransactionId) 514; +static TransactionId cachedTestXid = NullTransactionId; +static XidStatus cachedTestXidStatus; /* ---------------- * transaction recovery state variables @@ -76,7 +59,7 @@ TransactionId FirstTransactionId = (TransactionId) 514; * goes from zero to one. -cim 3/21/90 * ---------------- */ -int RecoveryCheckingEnableState = 0; +static int RecoveryCheckingEnableState = 0; /* ---------------- * recovery checking accessors @@ -203,14 +186,9 @@ TransactionLogUpdate(TransactionId transactionId, /* trans id to update */ /* * update (invalidate) our single item TransactionLogTest cache. - * - * if (status != XID_COMMIT) - * - * What's the hell ?! Why != XID_COMMIT ?! */ TransactionIdStore(transactionId, &cachedTestXid); cachedTestXidStatus = status; - } /* ---------------------------------------------------------------- @@ -355,17 +333,15 @@ InitializeTransactionLog(void) /* * if we have a virgin database, we initialize the log relation by - * committing the AmiTransactionId (id 512) and we initialize the + * committing the AmiTransactionId and we initialize the * variable relation by setting the next available transaction id to - * FirstTransactionId (id 514). OID initialization happens as a side + * FirstTransactionId. OID initialization happens as a side * effect of bootstrapping in varsup.c. */ SpinAcquire(OidGenLockId); if (!TransactionIdDidCommit(AmiTransactionId)) { TransactionLogUpdate(AmiTransactionId, XID_COMMIT); - TransactionIdStore(AmiTransactionId, &cachedTestXid); - cachedTestXidStatus = XID_COMMIT; Assert(!IsUnderPostmaster && ShmemVariableCache->nextXid <= FirstTransactionId); ShmemVariableCache->nextXid = FirstTransactionId; |