summaryrefslogtreecommitdiff
path: root/src/include/access
diff options
context:
space:
mode:
authorTom Lane2001-07-12 04:11:13 +0000
committerTom Lane2001-07-12 04:11:13 +0000
commitb9f3a929ee6b0309c50d837f464da7440303d2ef (patch)
treec3bd00b8b62a92bbfaf834dda3342df6f90453c6 /src/include/access
parenteaafc9d66c3196bd0d47cef2b0d8c2cafad504f3 (diff)
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/include/access')
-rw-r--r--src/include/access/heapam.h8
-rw-r--r--src/include/access/transam.h99
-rw-r--r--src/include/access/xact.h16
3 files changed, 43 insertions, 80 deletions
diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h
index 62b91e51623..2f9a6de2ad2 100644
--- a/src/include/access/heapam.h
+++ b/src/include/access/heapam.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: heapam.h,v 1.65 2001/06/22 19:16:23 wieck Exp $
+ * $Id: heapam.h,v 1.66 2001/07/12 04:11:13 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -15,6 +15,7 @@
#define HEAPAM_H
#include <time.h>
+
#include "access/htup.h"
#include "access/relscan.h"
#include "access/tupmacs.h"
@@ -218,6 +219,11 @@ extern void heap_restrpos(HeapScanDesc scan);
extern void heap_redo(XLogRecPtr lsn, XLogRecord *rptr);
extern void heap_undo(XLogRecPtr lsn, XLogRecord *rptr);
extern void heap_desc(char *buf, uint8 xl_info, char *rec);
+extern XLogRecPtr log_heap_clean(Relation reln, Buffer buffer,
+ char *unused, int unlen);
+extern XLogRecPtr log_heap_move(Relation reln, Buffer oldbuf,
+ ItemPointerData from,
+ Buffer newbuf, HeapTuple newtup);
/* in common/heaptuple.c */
extern Size ComputeDataSize(TupleDesc tupleDesc, Datum *value, char *nulls);
diff --git a/src/include/access/transam.h b/src/include/access/transam.h
index 90d1f359839..5d328b3c714 100644
--- a/src/include/access/transam.h
+++ b/src/include/access/transam.h
@@ -1,17 +1,13 @@
/*-------------------------------------------------------------------------
*
* transam.h
- * postgres transaction access method support code header
+ * postgres transaction access method support code
*
*
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: transam.h,v 1.35 2001/05/25 15:45:33 momjian Exp $
- *
- * NOTES
- * Transaction System Version 101 now support proper oid
- * generation and recording in the variable relation.
+ * $Id: transam.h,v 1.36 2001/07/12 04:11:13 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -20,77 +16,60 @@
#include "storage/bufmgr.h"
+
/* ----------------
- * transaction system version id
+ * Special transaction ID values
*
- * this is stored on the first page of the log, time and variable
- * relations on the first 4 bytes. This is so that if we improve
- * the format of the transaction log after postgres version 2, then
- * people won't have to rebuild their databases.
+ * We do not use any transaction IDs less than 512 --- this leaves the first
+ * 128 bytes of pg_log available for special purposes such as version number
+ * storage. (Currently, we do not actually use them for anything.)
*
- * TRANS_SYSTEM_VERSION 100 means major version 1 minor version 0.
- * Two databases with the same major version should be compatible,
- * even if their minor versions differ.
+ * AmiTransactionId is the XID for "bootstrap" operations. It should always
+ * be considered valid.
+ *
+ * FirstTransactionId is the first "normal" transaction id.
+ * ----------------
+ */
+#define NullTransactionId ((TransactionId) 0)
+#define DisabledTransactionId ((TransactionId) 1)
+#define AmiTransactionId ((TransactionId) 512)
+#define FirstTransactionId ((TransactionId) 514)
+
+/* ----------------
+ * transaction ID manipulation macros
* ----------------
*/
-#define TRANS_SYSTEM_VERSION 200
+#define TransactionIdIsValid(xid) ((bool) ((xid) != NullTransactionId))
+#define TransactionIdIsSpecial(xid) ((bool) ((xid) < FirstTransactionId))
+#define TransactionIdEquals(id1, id2) ((bool) ((id1) == (id2)))
+#define TransactionIdPrecedes(id1, id2) ((bool) ((id1) < (id2)))
+#define TransactionIdStore(xid, dest) \
+ (*((TransactionId*) (dest)) = (TransactionId) (xid))
+#define StoreInvalidTransactionId(dest) \
+ (*((TransactionId*) (dest)) = NullTransactionId)
/* ----------------
- * transaction id status values
+ * transaction status values
*
* someday we will use "11" = 3 = XID_COMMIT_CHILD to mean the
* commiting of child xactions.
* ----------------
*/
-#define XID_COMMIT 2 /* transaction commited */
-#define XID_ABORT 1 /* transaction aborted */
#define XID_INPROGRESS 0 /* transaction in progress */
+#define XID_ABORT 1 /* transaction aborted */
+#define XID_COMMIT 2 /* transaction commited */
#define XID_COMMIT_CHILD 3 /* child xact commited */
-typedef unsigned char XidStatus;/* (2 bits) */
+typedef unsigned char XidStatus; /* (2 bits) */
/* ----------
- * note: we reserve the first 16384 object ids for internal use.
+ * We reserve the first 16384 object ids for manual assignment.
* oid's less than this appear in the .bki files. the choice of
* 16384 is completely arbitrary.
* ----------
*/
#define BootstrapObjectIdData 16384
-/* ----------------
- * BitIndexOf computes the index of the Nth xid on a given block
- * ----------------
- */
-#define BitIndexOf(N) ((N) * 2)
-
-/* ----------------
- * transaction page definitions
- * ----------------
- */
-#define TP_DataSize (BLCKSZ - sizeof(XLogRecPtr))
-#define TP_NumXidStatusPerBlock (TP_DataSize * 4)
-
-/* ----------------
- * LogRelationContents structure
- *
- * This structure describes the storage of the data in the
- * first 128 bytes of the log relation. This storage is never
- * used for transaction status because transaction id's begin
- * their numbering at 512.
- *
- * The first 4 bytes of this relation store the version
- * number of the transaction system.
- * ----------------
- */
-typedef struct LogRelationContentsData
-{
- XLogRecPtr LSN; /* temp hack: LSN is member of any block */
- /* so should be described in bufmgr */
- int TransSystemVersion;
-} LogRelationContentsData;
-
-typedef LogRelationContentsData *LogRelationContents;
-
/*
* VariableCache is placed in shmem and used by
* backends to get next available XID & OID.
@@ -104,6 +83,7 @@ typedef struct VariableCacheData
typedef VariableCacheData *VariableCache;
+
/* ----------------
* extern declarations
* ----------------
@@ -142,16 +122,7 @@ extern void CheckMaxObjectId(Oid assigned_oid);
/* in transam.c */
extern Relation LogRelation;
-extern TransactionId cachedTestXid;
-extern XidStatus cachedTestXidStatus;
-
-extern TransactionId NullTransactionId;
-extern TransactionId AmiTransactionId;
-extern TransactionId FirstTransactionId;
-
-extern int RecoveryCheckingEnableState;
-
-/* in transsup.c */
+/* in xact.c */
extern bool AMI_OVERRIDE;
/* in varsup.c */
diff --git a/src/include/access/xact.h b/src/include/access/xact.h
index ab75ec001f0..abbe16ced38 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.33 2001/03/22 04:00:32 momjian Exp $
+ * $Id: xact.h,v 1.34 2001/07/12 04:11:13 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -67,17 +67,6 @@ typedef TransactionStateData *TransactionState;
#define TBLOCK_ABORT 4
#define TBLOCK_ENDABORT 5
-/* ----------------
- * transaction ID manipulation macros
- * ----------------
- */
-#define TransactionIdIsValid(xid) ((bool) ((xid) != NullTransactionId))
-#define TransactionIdEquals(id1, id2) ((bool) ((id1) == (id2)))
-#define TransactionIdStore(xid, dest) \
- (*((TransactionId*) (dest)) = (TransactionId) (xid))
-#define StoreInvalidTransactionId(dest) \
- (*((TransactionId*) (dest)) = NullTransactionId)
-
/*
* XLOG allows to store some information in high 4 bits of log
* record xl_info field
@@ -133,8 +122,6 @@ extern void AbortOutOfAnyTransaction(void);
extern void RecordTransactionCommit(void);
-extern TransactionId DisabledTransactionId;
-
extern void XactPushRollback(void (*func) (void *), void *data);
extern void XactPopRollback(void);
@@ -146,6 +133,5 @@ 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 void TransactionIdAdd(TransactionId *xid, int value);
#endif /* XACT_H */