summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorVadim B. Mikheev <vadim4o@yahoo.com>1998-12-15 12:47:01 +0000
committerVadim B. Mikheev <vadim4o@yahoo.com>1998-12-15 12:47:01 +0000
commit3f7fbf85dc5b42dfd33c803efe6c90533773576a (patch)
treedf8f84075ae7a27fa6b7ec0d063a03898e0b1bbb /src/include
parentc5a27161a188b235ce3c0afb1b12e8942ac8e963 (diff)
downloadpostgresql-3f7fbf85dc5b42dfd33c803efe6c90533773576a.tar.gz
Initial MVCC code.
New code for locking buffer' context.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/heapam.h16
-rw-r--r--src/include/access/hio.h6
-rw-r--r--src/include/access/htup.h3
-rw-r--r--src/include/access/xact.h4
-rw-r--r--src/include/catalog/pg_am.h3
-rw-r--r--src/include/catalog/pg_class.h7
-rw-r--r--src/include/commands/trigger.h9
-rw-r--r--src/include/storage/buf_internals.h63
-rw-r--r--src/include/storage/bufmgr.h13
-rw-r--r--src/include/storage/ipc.h4
-rw-r--r--src/include/storage/lmgr.h64
-rw-r--r--src/include/storage/lock.h12
-rw-r--r--src/include/storage/proc.h4
-rw-r--r--src/include/storage/s_lock.h4
-rw-r--r--src/include/utils/tqual.h35
15 files changed, 118 insertions, 129 deletions
diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h
index 0c756e0beb..e883c7f0a5 100644
--- a/src/include/access/heapam.h
+++ b/src/include/access/heapam.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: heapam.h,v 1.39 1998/11/27 19:33:31 vadim Exp $
+ * $Id: heapam.h,v 1.40 1998/12/15 12:46:44 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -42,6 +42,7 @@ typedef struct HeapAccessStatisticsData
int global_insert;
int global_delete;
int global_replace;
+ int global_mark4update;
int global_markpos;
int global_restrpos;
int global_BufferGetRelation;
@@ -64,6 +65,7 @@ typedef struct HeapAccessStatisticsData
int local_insert;
int local_delete;
int local_replace;
+ int local_mark4update;
int local_markpos;
int local_restrpos;
int local_BufferGetRelation;
@@ -253,9 +255,10 @@ extern void heap_endscan(HeapScanDesc scan);
extern HeapTuple heap_getnext(HeapScanDesc scandesc, int backw);
extern void heap_fetch(Relation relation, Snapshot snapshot, HeapTuple tup, Buffer *userbuf);
extern Oid heap_insert(Relation relation, HeapTuple tup);
-extern int heap_delete(Relation relation, ItemPointer tid);
-extern int heap_replace(Relation relation, ItemPointer otid,
- HeapTuple tup);
+extern int heap_delete(Relation relation, ItemPointer tid, ItemPointer ctid);
+extern int heap_replace(Relation relation, ItemPointer otid, HeapTuple tup,
+ ItemPointer ctid);
+extern int heap_mark4update(Relation relation, HeapTuple tup, Buffer *userbuf);
extern void heap_markpos(HeapScanDesc scan);
extern void heap_restrpos(HeapScanDesc scan);
@@ -281,9 +284,4 @@ HeapTuple heap_addheader(uint32 natts, int structlen, char *structure);
extern void PrintHeapAccessStatistics(HeapAccessStatistics stats);
extern void initam(void);
-/* hio.c */
-extern void RelationPutHeapTuple(Relation relation, BlockNumber blockIndex,
- HeapTuple tuple);
-extern void RelationPutHeapTupleAtEnd(Relation relation, HeapTuple tuple);
-
#endif /* HEAPAM_H */
diff --git a/src/include/access/hio.h b/src/include/access/hio.h
index caa5380083..eb8a955b4d 100644
--- a/src/include/access/hio.h
+++ b/src/include/access/hio.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: hio.h,v 1.8 1998/09/01 04:34:13 momjian Exp $
+ * $Id: hio.h,v 1.9 1998/12/15 12:46:45 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,8 +17,8 @@
#include <utils/rel.h>
-extern void RelationPutHeapTuple(Relation relation, BlockNumber blockIndex,
- HeapTuple tuple);
+extern void RelationPutHeapTuple(Relation relation, Buffer buffer,
+ HeapTuple tuple);
extern void RelationPutHeapTupleAtEnd(Relation relation, HeapTuple tuple);
#endif /* HIO_H */
diff --git a/src/include/access/htup.h b/src/include/access/htup.h
index 56197048ba..06c62a9a4d 100644
--- a/src/include/access/htup.h
+++ b/src/include/access/htup.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: htup.h,v 1.11 1998/11/27 19:33:31 vadim Exp $
+ * $Id: htup.h,v 1.12 1998/12/15 12:46:46 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -116,6 +116,7 @@ typedef HeapTupleData *HeapTuple;
#define HEAP_XMIN_INVALID 0x0200 /* t_xmin invalid/aborted */
#define HEAP_XMAX_COMMITTED 0x0400 /* t_xmax committed */
#define HEAP_XMAX_INVALID 0x0800 /* t_xmax invalid/aborted */
+#define HEAP_MARKED_FOR_UPDATE 0x1000 /* marked for UPDATE */
#define HEAP_XACT_MASK 0x0F00 /* */
diff --git a/src/include/access/xact.h b/src/include/access/xact.h
index e4c1e0a88c..6b0aae443f 100644
--- a/src/include/access/xact.h
+++ b/src/include/access/xact.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: xact.h,v 1.17 1998/10/08 18:30:23 momjian Exp $
+ * $Id: xact.h,v 1.18 1998/12/15 12:46:47 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -38,6 +38,8 @@ typedef struct TransactionStateData
#define XACT_REPEATABLE_READ 2 /* not implemented */
#define XACT_SERIALIZED 3
+extern int XactIsoLevel;
+
/* ----------------
* transaction states
* ----------------
diff --git a/src/include/catalog/pg_am.h b/src/include/catalog/pg_am.h
index 3106ffa7cc..bc3b9da1de 100644
--- a/src/include/catalog/pg_am.h
+++ b/src/include/catalog/pg_am.h
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_am.h,v 1.9 1998/09/01 04:34:47 momjian Exp $
+ * $Id: pg_am.h,v 1.10 1998/12/15 12:46:49 vadim Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@@ -106,6 +106,7 @@ DESCR("");
#define BTREE_AM_OID 403
DATA(insert OID = 405 ( hash PGUID "o" 1 1 hashgettuple hashinsert hashdelete - - - - hashbeginscan hashrescan hashendscan hashmarkpos hashrestrpos - - hashbuild - - ));
DESCR("");
+#define HASH_AM_OID 405
DATA(insert OID = 783 ( gist PGUID "o" 100 7 gistgettuple gistinsert gistdelete - - - - gistbeginscan gistrescan gistendscan gistmarkpos gistrestrpos - - gistbuild - - ));
DESCR("");
diff --git a/src/include/catalog/pg_class.h b/src/include/catalog/pg_class.h
index c96e05e393..c657375241 100644
--- a/src/include/catalog/pg_class.h
+++ b/src/include/catalog/pg_class.h
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_class.h,v 1.25 1998/09/10 15:32:31 vadim Exp $
+ * $Id: pg_class.h,v 1.26 1998/12/15 12:46:50 vadim Exp $
*
* NOTES
* ``pg_relation'' is being replaced by ``pg_class''. currently
@@ -144,6 +144,8 @@ DATA(insert OID = 1264 ( pg_variable 90 PGUID 0 0 0 f t s 2 0 0 0 0 0 f f _n
DESCR("");
DATA(insert OID = 1269 ( pg_log 99 PGUID 0 0 0 f t s 1 0 0 0 0 0 f f _null_ ));
DESCR("");
+DATA(insert OID = 376 ( pg_xactlock 0 PGUID 0 0 0 f t s 1 0 0 0 0 0 f f _null_ ));
+DESCR("");
DATA(insert OID = 1215 ( pg_attrdef 109 PGUID 0 0 0 t t r 4 0 0 0 0 0 f f _null_ ));
DESCR("");
DATA(insert OID = 1216 ( pg_relcheck 110 PGUID 0 0 0 t t r 4 0 0 0 0 0 f f _null_ ));
@@ -164,6 +166,9 @@ DESCR("");
#define RelOid_pg_relcheck 1216
#define RelOid_pg_trigger 1219
+/* Xact lock pseudo-table */
+#define XactLockTableId 376
+
#define RELKIND_INDEX 'i' /* secondary index */
#define RELKIND_LOBJECT 'l' /* large objects */
#define RELKIND_RELATION 'r' /* cataloged heap */
diff --git a/src/include/commands/trigger.h b/src/include/commands/trigger.h
index 3cc0fdcc06..b52c81dc72 100644
--- a/src/include/commands/trigger.h
+++ b/src/include/commands/trigger.h
@@ -12,6 +12,7 @@
#include "access/tupdesc.h"
#include "access/htup.h"
#include "nodes/parsenodes.h"
+#include "nodes/execnodes.h"
#include "utils/rel.h"
typedef uint32 TriggerEvent;
@@ -65,9 +66,9 @@ extern void RelationRemoveTriggers(Relation rel);
extern HeapTuple ExecBRInsertTriggers(Relation rel, HeapTuple tuple);
extern void ExecARInsertTriggers(Relation rel, HeapTuple tuple);
-extern bool ExecBRDeleteTriggers(Relation rel, ItemPointer tupleid);
-extern void ExecARDeleteTriggers(Relation rel, ItemPointer tupleid);
-extern HeapTuple ExecBRUpdateTriggers(Relation rel, ItemPointer tupleid, HeapTuple tuple);
-extern void ExecARUpdateTriggers(Relation rel, ItemPointer tupleid, HeapTuple tuple);
+extern bool ExecBRDeleteTriggers(EState *estate, ItemPointer tupleid);
+extern void ExecARDeleteTriggers(EState *estate, ItemPointer tupleid);
+extern HeapTuple ExecBRUpdateTriggers(EState *estate, ItemPointer tupleid, HeapTuple tuple);
+extern void ExecARUpdateTriggers(EState *estate, ItemPointer tupleid, HeapTuple tuple);
#endif /* TRIGGER_H */
diff --git a/src/include/storage/buf_internals.h b/src/include/storage/buf_internals.h
index 61f567b6d3..383204c3f0 100644
--- a/src/include/storage/buf_internals.h
+++ b/src/include/storage/buf_internals.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: buf_internals.h,v 1.26 1998/09/01 04:38:10 momjian Exp $
+ * $Id: buf_internals.h,v 1.27 1998/12/15 12:46:55 vadim Exp $
*
* NOTE
* If BUFFERPAGE0 is defined, then 0 will be used as a
@@ -83,32 +83,6 @@ struct buftag
* Dbname, relname, dbid, and relid are enough to determine where
* to put the buffer, for all storage managers.
*/
-
-#define PADDED_SBUFDESC_SIZE 128
-
-/* DO NOT CHANGE THIS NEXT STRUCTURE:
- It is used only to get padding information for the real sbufdesc structure
- It should match the sbufdesc structure exactly except for a missing sb_pad
-*/
-struct sbufdesc_unpadded
-{
- Buffer freeNext;
- Buffer freePrev;
- SHMEM_OFFSET data;
- BufferTag tag;
- int buf_id;
- BufFlags flags;
- unsigned refcount;
-#ifdef HAS_TEST_AND_SET
- slock_t io_in_progress_lock;
-#endif /* HAS_TEST_AND_SET */
- char sb_dbname[NAMEDATALEN];
-
- /* NOTE NO PADDING OF THE MEMBER HERE */
- char sb_relname[NAMEDATALEN];
-};
-
-/* THE REAL STRUCTURE - the structure above must match it, minus sb_pad */
struct sbufdesc
{
Buffer freeNext; /* link for freelist chain */
@@ -125,32 +99,26 @@ struct sbufdesc
#ifdef HAS_TEST_AND_SET
/* can afford a dedicated lock if test-and-set locks are available */
slock_t io_in_progress_lock;
+ slock_t cntx_lock; /* to lock access to page context */
#endif /* HAS_TEST_AND_SET */
+ unsigned r_locks; /* # of shared locks */
+ bool ri_lock; /* read-intent lock */
+ bool w_lock; /* context exclusively locked */
char sb_dbname[NAMEDATALEN]; /* name of db in which buf belongs */
-
- /*
- * I padded this structure to a power of 2 (PADDED_SBUFDESC_SIZE)
- * because BufferDescriptorGetBuffer is called a billion times and it
- * does an C pointer subtraction (i.e., "x - y" -> array index of x
- * relative to y, which is calculated using division by struct size).
- * Integer ".div" hits you for 35 cycles, as opposed to a 1-cycle
- * "sra" ... this hack cut 10% off of the time to create the Wisconsin
- * database! It eats up more shared memory, of course, but we're
- * (allegedly) going to make some of these types bigger soon anyway...
- * -pma 1/2/93
- */
-
- /*
- * please, don't take the sizeof() this member and use it for
- * something important
- */
-
- char sb_relname[NAMEDATALEN + /* name of reln */
- PADDED_SBUFDESC_SIZE - sizeof(struct sbufdesc_unpadded)];
+ char sb_relname[NAMEDATALEN];/* name of reln */
};
/*
+ * Buffer lock infos in BufferLocks below.
+ * We have to free these locks in elog(ERROR)...
+ */
+#define BL_IO_IN_PROGRESS (1 << 0) /* unimplemented */
+#define BL_R_LOCK (1 << 1)
+#define BL_RI_LOCK (1 << 2)
+#define BL_W_LOCK (1 << 3)
+
+/*
* mao tracing buffer allocation
*/
@@ -201,6 +169,7 @@ extern BufferDesc *BufferDescriptors;
extern BufferBlock BufferBlocks;
extern long *PrivateRefCount;
extern long *LastRefCount;
+extern bits8 *BufferLocks;
extern long *CommitInfoNeedsSave;
extern SPINLOCK BufMgrLock;
diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h
index 1948e813ee..22f66c2295 100644
--- a/src/include/storage/bufmgr.h
+++ b/src/include/storage/bufmgr.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: bufmgr.h,v 1.23 1998/10/08 18:30:43 momjian Exp $
+ * $Id: bufmgr.h,v 1.24 1998/12/15 12:46:56 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -74,6 +74,14 @@ extern int ShowPinTrace;
#define BUFFER_LATE_WRITE 1 /* delayed write: mark as DIRTY */
/*
+ * Buffer context lock modes
+ */
+#define BUFFER_LOCK_UNLOCK 0
+#define BUFFER_LOCK_SHARE 1
+#define BUFFER_LOCK_EXCLUSIVE 2
+
+
+/*
* BufferIsValid --
* True iff the refcnt of the local buffer is > 0
* Note:
@@ -155,4 +163,7 @@ extern void BufferRefCountRestore(int *refcountsave);
extern int SetBufferWriteMode(int mode);
extern void SetBufferCommitInfoNeedsSave(Buffer buffer);
+extern void UnlockBuffers(void);
+extern void LockBuffer(Buffer buffer, int mode);
+
#endif /* !defined(BufMgrIncluded) */
diff --git a/src/include/storage/ipc.h b/src/include/storage/ipc.h
index 4733b34bbc..2163aa79d5 100644
--- a/src/include/storage/ipc.h
+++ b/src/include/storage/ipc.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: ipc.h,v 1.30 1998/09/01 04:38:16 momjian Exp $
+ * $Id: ipc.h,v 1.31 1998/12/15 12:46:57 vadim Exp $
*
* NOTES
* This file is very architecture-specific. This stuff should actually
@@ -186,6 +186,8 @@ typedef enum _LockId_
((key == PrivateIPCKey) ? key : 11 + (key))
#define IPCKeyGetWaitIOSemaphoreKey(key) \
((key == PrivateIPCKey) ? key : 12 + (key))
+#define IPCKeyGetWaitCLSemaphoreKey(key) \
+ ((key == PrivateIPCKey) ? key : 13 + (key))
/* --------------------------
* NOTE: This macro must always give the highest numbered key as every backend
diff --git a/src/include/storage/lmgr.h b/src/include/storage/lmgr.h
index 4082811bcc..a85ba1e8ff 100644
--- a/src/include/storage/lmgr.h
+++ b/src/include/storage/lmgr.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: lmgr.h,v 1.15 1998/09/01 04:38:23 momjian Exp $
+ * $Id: lmgr.h,v 1.16 1998/12/15 12:46:57 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,64 +17,48 @@
#include <utils/rel.h>
#include <catalog/catname.h>
-/*
- * This was moved from pladt.h for the new lock manager. Want to obsolete
- * all of the old code.
- */
+#define AccessShareLock 1 /* SELECT */
+#define RowShareLock 2 /* SELECT FOR UPDATE */
+#define RowExclusiveLock 3 /* INSERT, UPDATE, DELETE */
+#define ShareLock 4
+#define ShareRowExclusiveLock 5
+#define ExclusiveLock 6
+#define AccessExclusiveLock 7
+
+#define ExtendLock 8
+
+extern LOCKMETHOD LockTableId;
+
+
typedef struct LockRelId
{
Oid relId; /* a relation identifier */
Oid dbId; /* a database identifier */
} LockRelId;
-#ifdef LowLevelLocking
typedef struct LockInfoData
{
LockRelId lockRelId;
- bool lockHeld[MAX_LOCKMODES]; /* on table level */
} LockInfoData;
-#else
-typedef struct LockInfoData
-{
- LockRelId lockRelId;
-} LockInfoData;
-
-#endif
-
typedef LockInfoData *LockInfo;
#define LockInfoIsValid(lockinfo) PointerIsValid(lockinfo)
+extern LOCKMETHOD InitLockTable(void);
extern void RelationInitLockInfo(Relation relation);
-extern void RelationSetLockForDescriptorOpen(Relation relation);
-extern void RelationSetLockForRead(Relation relation);
-extern void RelationUnsetLockForRead(Relation relation);
-extern void RelationSetLockForWrite(Relation relation);
-extern void RelationUnsetLockForWrite(Relation relation);
-/* used in vaccum.c */
-extern void RelationSetLockForWritePage(Relation relation,
- ItemPointer itemPointer);
+extern void LockRelation(Relation relation, LOCKMODE lockmode);
+extern void UnlockRelation(Relation relation, LOCKMODE lockmode);
-/* used in nbtpage.c, hashpage.c */
-extern void RelationSetSingleWLockPage(Relation relation,
- ItemPointer itemPointer);
-extern void RelationUnsetSingleWLockPage(Relation relation,
- ItemPointer itemPointer);
-extern void RelationSetSingleRLockPage(Relation relation,
- ItemPointer itemPointer);
-extern void RelationUnsetSingleRLockPage(Relation relation,
- ItemPointer itemPointer);
-extern void RelationSetRIntentLock(Relation relation);
-extern void RelationUnsetRIntentLock(Relation relation);
-extern void RelationSetWIntentLock(Relation relation);
-extern void RelationUnsetWIntentLock(Relation relation);
+/* this is for indices */
+extern void LockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode);
+extern void UnlockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode);
-/* single.c */
-extern bool SingleLockReln(LockInfo lockinfo, LOCKMODE lockmode, int action);
-extern bool SingleLockPage(LockInfo lockinfo, ItemPointer tidPtr,
- LOCKMODE lockmode, int action);
+/* and this is for transactions */
+extern void XactLockTableInsert(TransactionId xid);
+extern void XactLockTableDelete(TransactionId xid);
+extern void XactLockTableWait(TransactionId xid);
/* proc.c */
extern void InitProcGlobal(IPCKey key);
diff --git a/src/include/storage/lock.h b/src/include/storage/lock.h
index 329aa758a7..9c803ef8a1 100644
--- a/src/include/storage/lock.h
+++ b/src/include/storage/lock.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: lock.h,v 1.19 1998/10/08 18:30:45 momjian Exp $
+ * $Id: lock.h,v 1.20 1998/12/15 12:46:58 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -42,11 +42,7 @@ typedef int LOCKMODE;
typedef int LOCKMETHOD;
/* MAX_LOCKMODES cannot be larger than the bits in MASK */
-#ifdef LowLevelLocking
#define MAX_LOCKMODES 9
-#else
-#define MAX_LOCKMODES 6
-#endif
/*
* MAX_LOCK_METHODS corresponds to the number of spin locks allocated in
@@ -69,7 +65,11 @@ typedef struct LTAG
{
Oid relId;
Oid dbId;
- ItemPointerData tupleId;
+ union
+ {
+ BlockNumber blkno;
+ TransactionId xid;
+ } objId;
uint16 lockmethod; /* needed by user locks */
} LOCKTAG;
diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h
index 4a62fac18a..914d934524 100644
--- a/src/include/storage/proc.h
+++ b/src/include/storage/proc.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: proc.h,v 1.15 1998/09/01 04:38:31 momjian Exp $
+ * $Id: proc.h,v 1.16 1998/12/15 12:46:59 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -44,11 +44,9 @@ typedef struct proc
TransactionId xid; /* transaction currently being executed by
* this proc */
-#ifdef LowLevelLocking
TransactionId xmin; /* minimal running XID as it was when we
* were starting our xact: vacuum must not
* remove tuples deleted by xid >= xmin ! */
-#endif
LOCK *waitLock; /* Lock we're sleeping on */
int token; /* info for proc wakeup routines */
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index d47f5ab53b..aa20a328bd 100644
--- a/src/include/storage/s_lock.h
+++ b/src/include/storage/s_lock.h
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.56 1998/10/31 02:06:08 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.57 1998/12/15 12:46:59 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -68,6 +68,8 @@
#include "storage/ipc.h"
+extern void s_lock_sleep(unsigned spin);
+
#if defined(HAS_TEST_AND_SET)
diff --git a/src/include/utils/tqual.h b/src/include/utils/tqual.h
index 3d2f8531f4..cb15a60ca0 100644
--- a/src/include/utils/tqual.h
+++ b/src/include/utils/tqual.h
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: tqual.h,v 1.15 1998/11/27 19:33:35 vadim Exp $
+ * $Id: tqual.h,v 1.16 1998/12/15 12:47:01 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,17 +18,20 @@
typedef struct SnapshotData
{
- TransactionId xmin; /* XID < xmin are visible to me */
- TransactionId xmax; /* XID > xmax are invisible to me */
- TransactionId *xip; /* array of xacts in progress */
+ TransactionId xmin; /* XID < xmin are visible to me */
+ TransactionId xmax; /* XID > xmax are invisible to me */
+ TransactionId *xip; /* array of xacts in progress */
} SnapshotData;
typedef SnapshotData *Snapshot;
-#define IsSnapshotNow(snapshot) ((Snapshot) snapshot == (Snapshot) 0x0)
-#define IsSnapshotSelf(snapshot) ((Snapshot) snapshot == (Snapshot) 0x1)
#define SnapshotNow ((Snapshot) 0x0)
#define SnapshotSelf ((Snapshot) 0x1)
+extern Snapshot SnapshotDirty;
+
+#define IsSnapshotNow(snapshot) ((Snapshot) snapshot == SnapshotNow)
+#define IsSnapshotSelf(snapshot) ((Snapshot) snapshot == SnapshotSelf)
+#define IsSnapshotDirty(snapshot) ((Snapshot) snapshot == SnapshotDirty)
extern TransactionId HeapSpecialTransactionId;
extern CommandId HeapSpecialCommandId;
@@ -49,7 +52,11 @@ extern CommandId HeapSpecialCommandId;
(IsSnapshotSelf(snapshot) || heapisoverride()) ? \
HeapTupleSatisfiesItself((tuple)->t_data) \
: \
- HeapTupleSatisfiesNow((tuple)->t_data) \
+ ((IsSnapshotDirty(snapshot)) ? \
+ HeapTupleSatisfiesDirty((tuple)->t_data) \
+ : \
+ HeapTupleSatisfiesNow((tuple)->t_data) \
+ ) \
) \
)
@@ -71,10 +78,18 @@ extern CommandId HeapSpecialCommandId;
) \
)
-extern bool HeapTupleSatisfiesItself(HeapTupleHeader tuple);
-extern bool HeapTupleSatisfiesNow(HeapTupleHeader tuple);
+#define HeapTupleMayBeUpdated 0
+#define HeapTupleInvisible 1
+#define HeapTupleSelfUpdated 2
+#define HeapTupleUpdated 3
+#define HeapTupleBeingUpdated 4
-extern void setheapoverride(bool on);
+extern bool HeapTupleSatisfiesItself(HeapTupleHeader tuple);
+extern bool HeapTupleSatisfiesNow(HeapTupleHeader tuple);
+extern bool HeapTupleSatisfiesDirty(HeapTupleHeader tuple);
+extern int HeapTupleSatisfiesUpdate(HeapTuple tuple);
+extern void setheapoverride(bool on);
+extern Snapshot GetSnapshotData(bool serialized);
#endif /* TQUAL_H */