summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-07-01 00:52:04 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-07-01 00:52:04 +0000
commit573a71a5da70d6e2503c8f53e3b4f26b3b6d738d (patch)
tree070f677b0043631518f83ce84ff201bf8fda700f /src/include
parent4c9aa572fa2ee60e8ac557b866eccc7310df0a09 (diff)
downloadpostgresql-573a71a5da70d6e2503c8f53e3b4f26b3b6d738d.tar.gz
Nested transactions. There is still much left to do, especially on the
performance front, but with feature freeze upon us I think it's time to drive a stake in the ground and say that this will be in 7.5. Alvaro Herrera, with some help from Tom Lane.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/clog.h15
-rw-r--r--src/include/access/gistscan.h3
-rw-r--r--src/include/access/hash.h3
-rw-r--r--src/include/access/htup.h67
-rw-r--r--src/include/access/rmgr.h4
-rw-r--r--src/include/access/rtree.h3
-rw-r--r--src/include/access/slru.h11
-rw-r--r--src/include/access/subtrans.h35
-rw-r--r--src/include/access/transam.h7
-rw-r--r--src/include/access/xact.h41
-rw-r--r--src/include/access/xlog.h4
-rw-r--r--src/include/catalog/catversion.h4
-rw-r--r--src/include/commands/async.h5
-rw-r--r--src/include/commands/tablecmds.h7
-rw-r--r--src/include/commands/trigger.h38
-rw-r--r--src/include/executor/spi.h3
-rw-r--r--src/include/executor/spi_priv.h3
-rw-r--r--src/include/storage/bufmgr.h4
-rw-r--r--src/include/storage/bufpage.h9
-rw-r--r--src/include/storage/lock.h29
-rw-r--r--src/include/storage/proc.h5
-rw-r--r--src/include/storage/smgr.h5
-rw-r--r--src/include/utils/catcache.h10
-rw-r--r--src/include/utils/guc.h6
-rw-r--r--src/include/utils/guc_tables.h52
-rw-r--r--src/include/utils/inval.h12
-rw-r--r--src/include/utils/memutils.h3
-rw-r--r--src/include/utils/portal.h5
-rw-r--r--src/include/utils/rel.h5
-rw-r--r--src/include/utils/relcache.h6
30 files changed, 242 insertions, 162 deletions
diff --git a/src/include/access/clog.h b/src/include/access/clog.h
index bd7f4152be..2df1cedc1c 100644
--- a/src/include/access/clog.h
+++ b/src/include/access/clog.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/clog.h,v 1.8 2003/11/29 22:40:55 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/access/clog.h,v 1.9 2004/07/01 00:51:38 tgl Exp $
*/
#ifndef CLOG_H
#define CLOG_H
@@ -16,13 +16,16 @@
/*
* Possible transaction statuses --- note that all-zeroes is the initial
* state.
+ *
+ * A "subcommitted" transaction is a committed subtransaction whose parent
+ * hasn't committed or aborted yet.
*/
typedef int XidStatus;
#define TRANSACTION_STATUS_IN_PROGRESS 0x00
#define TRANSACTION_STATUS_COMMITTED 0x01
#define TRANSACTION_STATUS_ABORTED 0x02
-/* 0x03 is available without changing commit log space allocation */
+#define TRANSACTION_STATUS_SUB_COMMITTED 0x03
/* exported because lwlock.c needs it */
#define NUM_CLOG_BUFFERS 8
@@ -39,12 +42,6 @@ extern void ShutdownCLOG(void);
extern void CheckPointCLOG(void);
extern void ExtendCLOG(TransactionId newestXact);
extern void TruncateCLOG(TransactionId oldestXact);
-
-/* XLOG stuff */
-#define CLOG_ZEROPAGE 0x00
-
-extern void clog_redo(XLogRecPtr lsn, XLogRecord *record);
-extern void clog_undo(XLogRecPtr lsn, XLogRecord *record);
-extern void clog_desc(char *buf, uint8 xl_info, char *rec);
+extern void clog_zeropage_redo(int pageno);
#endif /* CLOG_H */
diff --git a/src/include/access/gistscan.h b/src/include/access/gistscan.h
index b846642995..4022f54275 100644
--- a/src/include/access/gistscan.h
+++ b/src/include/access/gistscan.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/gistscan.h,v 1.22 2003/11/29 22:40:55 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/access/gistscan.h,v 1.23 2004/07/01 00:51:38 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,5 +23,6 @@ extern Datum gistrestrpos(PG_FUNCTION_ARGS);
extern Datum gistendscan(PG_FUNCTION_ARGS);
extern void gistadjscans(Relation r, int op, BlockNumber blkno, OffsetNumber offnum);
extern void AtEOXact_gist(void);
+extern void AtEOSubXact_gist(TransactionId childXid);
#endif /* GISTSCAN_H */
diff --git a/src/include/access/hash.h b/src/include/access/hash.h
index ffeea63417..2088cc2f5a 100644
--- a/src/include/access/hash.h
+++ b/src/include/access/hash.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/hash.h,v 1.54 2003/11/29 22:40:55 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/access/hash.h,v 1.55 2004/07/01 00:51:38 tgl Exp $
*
* NOTES
* modeled after Margo Seltzer's hash implementation for unix.
@@ -293,6 +293,7 @@ extern void _hash_regscan(IndexScanDesc scan);
extern void _hash_dropscan(IndexScanDesc scan);
extern bool _hash_has_active_scan(Relation rel, Bucket bucket);
extern void AtEOXact_hash(void);
+extern void AtEOSubXact_hash(TransactionId childXid);
/* hashsearch.c */
extern bool _hash_next(IndexScanDesc scan, ScanDirection dir);
diff --git a/src/include/access/htup.h b/src/include/access/htup.h
index 3d48b5f45a..fdcfc8dc6f 100644
--- a/src/include/access/htup.h
+++ b/src/include/access/htup.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/htup.h,v 1.65 2004/04/01 21:28:45 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/access/htup.h,v 1.66 2004/07/01 00:51:38 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -109,18 +109,14 @@
typedef struct HeapTupleFields
{
TransactionId t_xmin; /* inserting xact ID */
-
- union
- {
- CommandId t_cmin; /* inserting command ID */
- TransactionId t_xmax; /* deleting xact ID */
- } t_field2;
+ CommandId t_cmin; /* inserting command ID */
+ TransactionId t_xmax; /* deleting xact ID */
union
{
CommandId t_cmax; /* deleting command ID */
TransactionId t_xvac; /* VACUUM FULL xact ID */
- } t_field3;
+ } t_field4;
} HeapTupleFields;
typedef struct DatumTupleFields
@@ -172,9 +168,7 @@ typedef HeapTupleHeaderData *HeapTupleHeader;
* attribute(s) */
#define HEAP_HASEXTENDED 0x000C /* the two above combined */
#define HEAP_HASOID 0x0010 /* has an object-id field */
-/* bit 0x0020 is presently unused */
-#define HEAP_XMAX_IS_XMIN 0x0040 /* created and deleted in the same
- * transaction */
+/* 0x0020 and 0x0040 are unused */
#define HEAP_XMAX_UNLOGGED 0x0080 /* to lock tuple for update
* without logging */
#define HEAP_XMIN_COMMITTED 0x0100 /* t_xmin committed */
@@ -211,62 +205,47 @@ typedef HeapTupleHeaderData *HeapTupleHeader;
#define HeapTupleHeaderGetXmax(tup) \
( \
- ((tup)->t_infomask & HEAP_XMAX_IS_XMIN) ? \
- (tup)->t_choice.t_heap.t_xmin \
- : \
- (tup)->t_choice.t_heap.t_field2.t_xmax \
+ (tup)->t_choice.t_heap.t_xmax \
)
#define HeapTupleHeaderSetXmax(tup, xid) \
-do { \
- TransactionId _newxid = (xid); \
- if (TransactionIdEquals((tup)->t_choice.t_heap.t_xmin, _newxid)) \
- (tup)->t_infomask |= HEAP_XMAX_IS_XMIN; \
- else \
- { \
- (tup)->t_infomask &= ~HEAP_XMAX_IS_XMIN; \
- TransactionIdStore(_newxid, &(tup)->t_choice.t_heap.t_field2.t_xmax); \
- } \
-} while (0)
+( \
+ TransactionIdStore((xid), &(tup)->t_choice.t_heap.t_xmax) \
+)
-/*
- * Note: GetCmin will produce wrong answers after SetXmax has been executed
- * by a transaction other than the inserting one. We could check
- * HEAP_XMAX_INVALID and return FirstCommandId if it's clear, but since that
- * bit will be set again if the deleting transaction aborts, there'd be no
- * real gain in safety from the extra test. So, just rely on the caller not
- * to trust the value unless it's meaningful.
- */
#define HeapTupleHeaderGetCmin(tup) \
( \
- (tup)->t_choice.t_heap.t_field2.t_cmin \
+ (tup)->t_choice.t_heap.t_cmin \
)
#define HeapTupleHeaderSetCmin(tup, cid) \
-do { \
- Assert((tup)->t_infomask & HEAP_XMAX_INVALID); \
- (tup)->t_choice.t_heap.t_field2.t_cmin = (cid); \
-} while (0)
+( \
+ (tup)->t_choice.t_heap.t_cmin = (cid) \
+)
/*
- * As with GetCmin, we can't completely ensure that GetCmax can detect whether
- * a valid command ID is available, and there's little point in a partial test.
+ * Note: GetCmax will produce wrong answers after SetXvac has been executed
+ * by a transaction other than the inserting one. We could check
+ * HEAP_XMAX_INVALID and return FirstCommandId if it's clear, but since that
+ * bit will be set again if the deleting transaction aborts, there'd be no
+ * real gain in safety from the extra test. So, just rely on the caller not
+ * to trust the value unless it's meaningful.
*/
#define HeapTupleHeaderGetCmax(tup) \
( \
- (tup)->t_choice.t_heap.t_field3.t_cmax \
+ (tup)->t_choice.t_heap.t_field4.t_cmax \
)
#define HeapTupleHeaderSetCmax(tup, cid) \
do { \
Assert(!((tup)->t_infomask & HEAP_MOVED)); \
- (tup)->t_choice.t_heap.t_field3.t_cmax = (cid); \
+ (tup)->t_choice.t_heap.t_field4.t_cmax = (cid); \
} while (0)
#define HeapTupleHeaderGetXvac(tup) \
( \
((tup)->t_infomask & HEAP_MOVED) ? \
- (tup)->t_choice.t_heap.t_field3.t_xvac \
+ (tup)->t_choice.t_heap.t_field4.t_xvac \
: \
InvalidTransactionId \
)
@@ -274,7 +253,7 @@ do { \
#define HeapTupleHeaderSetXvac(tup, xid) \
do { \
Assert((tup)->t_infomask & HEAP_MOVED); \
- TransactionIdStore((xid), &(tup)->t_choice.t_heap.t_field3.t_xvac); \
+ TransactionIdStore((xid), &(tup)->t_choice.t_heap.t_field4.t_xvac); \
} while (0)
#define HeapTupleHeaderGetDatumLength(tup) \
diff --git a/src/include/access/rmgr.h b/src/include/access/rmgr.h
index e63e3fbc31..7ea3134031 100644
--- a/src/include/access/rmgr.h
+++ b/src/include/access/rmgr.h
@@ -3,7 +3,7 @@
*
* Resource managers definition
*
- * $PostgreSQL: pgsql/src/include/access/rmgr.h,v 1.10 2003/11/29 22:40:55 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/access/rmgr.h,v 1.11 2004/07/01 00:51:38 tgl Exp $
*/
#ifndef RMGR_H
#define RMGR_H
@@ -16,7 +16,7 @@ typedef uint8 RmgrId;
#define RM_XLOG_ID 0
#define RM_XACT_ID 1
#define RM_SMGR_ID 2
-#define RM_CLOG_ID 3
+#define RM_SLRU_ID 3
#define RM_HEAP_ID 10
#define RM_BTREE_ID 11
#define RM_HASH_ID 12
diff --git a/src/include/access/rtree.h b/src/include/access/rtree.h
index fdb33eba06..5b5347e9a0 100644
--- a/src/include/access/rtree.h
+++ b/src/include/access/rtree.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/rtree.h,v 1.32 2003/11/29 22:40:55 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/access/rtree.h,v 1.33 2004/07/01 00:51:38 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -130,6 +130,7 @@ extern void rtree_desc(char *buf, uint8 xl_info, char *rec);
extern void rtadjscans(Relation r, int op, BlockNumber blkno,
OffsetNumber offnum);
extern void AtEOXact_rtree(void);
+extern void AtEOSubXact_rtree(TransactionId childXid);
/* rtstrat.c */
extern StrategyNumber RTMapToInternalOperator(StrategyNumber strat);
diff --git a/src/include/access/slru.h b/src/include/access/slru.h
index 213cca5c21..e3245fac65 100644
--- a/src/include/access/slru.h
+++ b/src/include/access/slru.h
@@ -6,11 +6,12 @@
* Portions Copyright (c) 2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/slru.h,v 1.6 2004/05/31 03:48:08 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/access/slru.h,v 1.7 2004/07/01 00:51:38 tgl Exp $
*/
#ifndef SLRU_H
#define SLRU_H
+#include "access/xlog.h"
#include "storage/lwlock.h"
@@ -56,4 +57,12 @@ extern void SimpleLruSetLatestPage(SlruCtl ctl, int pageno);
extern void SimpleLruFlush(SlruCtl ctl, bool checkpoint);
extern void SimpleLruTruncate(SlruCtl ctl, int cutoffPage);
+/* XLOG stuff */
+#define CLOG_ZEROPAGE 0x00
+#define SUBTRANS_ZEROPAGE 0x10
+
+extern void slru_redo(XLogRecPtr lsn, XLogRecord *record);
+extern void slru_undo(XLogRecPtr lsn, XLogRecord *record);
+extern void slru_desc(char *buf, uint8 xl_info, char *rec);
+
#endif /* SLRU_H */
diff --git a/src/include/access/subtrans.h b/src/include/access/subtrans.h
new file mode 100644
index 0000000000..2c601752d1
--- /dev/null
+++ b/src/include/access/subtrans.h
@@ -0,0 +1,35 @@
+/*
+ * subtrans.h
+ *
+ * PostgreSQL subtrans-log manager
+ *
+ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * $PostgreSQL: pgsql/src/include/access/subtrans.h,v 1.1 2004/07/01 00:51:38 tgl Exp $
+ */
+#ifndef SUBTRANS_H
+#define SUBTRANS_H
+
+#include "access/xlog.h"
+
+/* exported because lwlock.c needs it */
+/* cannot be different from NUM_CLOG_BUFFERS without slru.c changes */
+#define NUM_SUBTRANS_BUFFERS NUM_CLOG_BUFFERS
+
+extern void SubTransSetParent(TransactionId xid, TransactionId parent);
+extern TransactionId SubTransGetParent(TransactionId xid);
+extern TransactionId SubTransGetTopmostTransaction(TransactionId xid);
+extern bool SubTransXidsHaveCommonAncestor(TransactionId xid1, TransactionId xid2);
+
+extern int SUBTRANSShmemSize(void);
+extern void SUBTRANSShmemInit(void);
+extern void BootStrapSUBTRANS(void);
+extern void StartupSUBTRANS(void);
+extern void ShutdownSUBTRANS(void);
+extern void CheckPointSUBTRANS(void);
+extern void ExtendSUBTRANS(TransactionId newestXact);
+extern void TruncateSUBTRANS(TransactionId oldestXact);
+extern void subtrans_zeropage_redo(int pageno);
+
+#endif /* SUBTRANS_H */
diff --git a/src/include/access/transam.h b/src/include/access/transam.h
index 3a2cad7bb0..44e0ff6ea7 100644
--- a/src/include/access/transam.h
+++ b/src/include/access/transam.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/transam.h,v 1.48 2003/11/29 22:40:55 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/access/transam.h,v 1.49 2004/07/01 00:51:38 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -107,13 +107,16 @@ extern bool TransactionIdDidCommit(TransactionId transactionId);
extern bool TransactionIdDidAbort(TransactionId transactionId);
extern void TransactionIdCommit(TransactionId transactionId);
extern void TransactionIdAbort(TransactionId transactionId);
+extern void TransactionIdSubCommit(TransactionId transactionId);
+extern void TransactionIdCommitTree(int nxids, TransactionId *xids);
+extern void TransactionIdAbortTree(int nxids, TransactionId *xids);
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);
+extern TransactionId GetNewTransactionId(bool isSubXact);
extern TransactionId ReadNewTransactionId(void);
extern Oid GetNewObjectId(void);
extern void CheckMaxObjectId(Oid assigned_oid);
diff --git a/src/include/access/xact.h b/src/include/access/xact.h
index 53a585ec69..c5b66afd0d 100644
--- a/src/include/access/xact.h
+++ b/src/include/access/xact.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/xact.h,v 1.63 2004/05/22 23:14:38 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/access/xact.h,v 1.64 2004/07/01 00:51:38 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -63,7 +63,15 @@ typedef enum TBlockState
TBLOCK_INPROGRESS,
TBLOCK_END,
TBLOCK_ABORT,
- TBLOCK_ENDABORT
+ TBLOCK_ENDABORT,
+
+ TBLOCK_SUBBEGIN,
+ TBLOCK_SUBBEGINABORT,
+ TBLOCK_SUBINPROGRESS,
+ TBLOCK_SUBEND,
+ TBLOCK_SUBABORT,
+ TBLOCK_SUBENDABORT_OK,
+ TBLOCK_SUBENDABORT_ERROR
} TBlockState;
/*
@@ -76,12 +84,15 @@ typedef void (*EOXactCallback) (bool isCommit, void *arg);
*/
typedef struct TransactionStateData
{
- TransactionId transactionIdData;
- CommandId commandId;
- AbsoluteTime startTime;
- int startTimeUsec;
- TransState state;
- TBlockState blockState;
+ TransactionId transactionIdData; /* my XID */
+ CommandId commandId; /* current CID */
+ TransState state; /* low-level state */
+ TBlockState blockState; /* high-level state */
+ int nestingLevel; /* nest depth */
+ MemoryContext curTransactionContext; /* my xact-lifetime context */
+ List *childXids; /* subcommitted child XIDs */
+ AclId currentUser; /* subxact start current_user */
+ struct TransactionStateData *parent; /* back link to parent */
} TransactionStateData;
typedef TransactionStateData *TransactionState;
@@ -102,9 +113,11 @@ typedef TransactionStateData *TransactionState;
typedef struct xl_xact_commit
{
time_t xtime;
+ int nrels; /* number of RelFileNodes */
+ int nsubxacts; /* number of subtransaction XIDs */
/* Array of RelFileNode(s) to drop at commit */
- /* The XLOG record length determines how many there are */
RelFileNode xnodes[1]; /* VARIABLE LENGTH ARRAY */
+ /* ARRAY OF COMMITTED SUBTRANSACTION XIDs FOLLOWS */
} xl_xact_commit;
#define MinSizeOfXactCommit offsetof(xl_xact_commit, xnodes)
@@ -112,9 +125,11 @@ typedef struct xl_xact_commit
typedef struct xl_xact_abort
{
time_t xtime;
+ int nrels; /* number of RelFileNodes */
+ int nsubxacts; /* number of subtransaction XIDs */
/* Array of RelFileNode(s) to drop at abort */
- /* The XLOG record length determines how many there are */
RelFileNode xnodes[1]; /* VARIABLE LENGTH ARRAY */
+ /* ARRAY OF ABORTED SUBTRANSACTION XIDs FOLLOWS */
} xl_xact_abort;
#define MinSizeOfXactAbort offsetof(xl_xact_abort, xnodes)
@@ -126,18 +141,20 @@ typedef struct xl_xact_abort
*/
extern bool IsTransactionState(void);
extern bool IsAbortedTransactionBlockState(void);
+extern TransactionId GetTopTransactionId(void);
extern TransactionId GetCurrentTransactionId(void);
extern CommandId GetCurrentCommandId(void);
extern AbsoluteTime GetCurrentTransactionStartTime(void);
extern AbsoluteTime GetCurrentTransactionStartTimeUsec(int *usec);
+extern int GetCurrentTransactionNestLevel(void);
extern bool TransactionIdIsCurrentTransactionId(TransactionId xid);
-extern bool CommandIdIsCurrentCommandId(CommandId cid);
extern void CommandCounterIncrement(void);
extern void StartTransactionCommand(void);
extern void CommitTransactionCommand(void);
extern void AbortCurrentTransaction(void);
extern void BeginTransactionBlock(void);
extern void EndTransactionBlock(void);
+extern bool IsSubTransaction(void);
extern bool IsTransactionBlock(void);
extern bool IsTransactionOrTransactionBlock(void);
extern char TransactionBlockStatusCode(void);
@@ -151,6 +168,8 @@ extern void UnregisterEOXactCallback(EOXactCallback callback, void *arg);
extern void RecordTransactionCommit(void);
+extern int xactGetCommittedChildren(TransactionId **ptr, bool metoo);
+
extern void XactPushRollback(void (*func) (void *), void *data);
extern void XactPopRollback(void);
diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h
index 0e44e77446..1c29ab0762 100644
--- a/src/include/access/xlog.h
+++ b/src/include/access/xlog.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/xlog.h,v 1.51 2004/05/29 22:48:22 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/access/xlog.h,v 1.52 2004/07/01 00:51:38 tgl Exp $
*/
#ifndef XLOG_H
#define XLOG_H
@@ -111,7 +111,7 @@ typedef struct XLogContRecord
/*
* Each page of XLOG file has a header like this:
*/
-#define XLOG_PAGE_MAGIC 0xD05A /* can be used as WAL version indicator */
+#define XLOG_PAGE_MAGIC 0xD05B /* can be used as WAL version indicator */
typedef struct XLogPageHeaderData
{
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index ac6f8a1fa0..b6f9877862 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.240 2004/06/25 17:20:28 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.241 2004/07/01 00:51:39 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 200406251
+#define CATALOG_VERSION_NO 200406261
#endif
diff --git a/src/include/commands/async.h b/src/include/commands/async.h
index 6429895fbd..47bd91aaaa 100644
--- a/src/include/commands/async.h
+++ b/src/include/commands/async.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/commands/async.h,v 1.24 2004/05/23 03:50:45 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/commands/async.h,v 1.25 2004/07/01 00:51:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,6 +23,9 @@ extern void Async_Unlisten(char *relname, int pid);
/* perform (or cancel) outbound notify processing at transaction commit */
extern void AtCommit_Notify(void);
extern void AtAbort_Notify(void);
+extern void AtSubStart_Notify(void);
+extern void AtSubCommit_Notify(void);
+extern void AtSubAbort_Notify(void);
/* signal handler for inbound notifies (SIGUSR2) */
extern void NotifyInterruptHandler(SIGNAL_ARGS);
diff --git a/src/include/commands/tablecmds.h b/src/include/commands/tablecmds.h
index f9f03c1bd0..73021fbb91 100644
--- a/src/include/commands/tablecmds.h
+++ b/src/include/commands/tablecmds.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/commands/tablecmds.h,v 1.16 2004/05/05 04:48:47 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/commands/tablecmds.h,v 1.17 2004/07/01 00:51:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -42,6 +42,9 @@ extern void register_on_commit_action(Oid relid, OnCommitAction action);
extern void remove_on_commit_action(Oid relid);
extern void PreCommit_on_commit_actions(void);
-extern void AtEOXact_on_commit_actions(bool isCommit);
+extern void AtEOXact_on_commit_actions(bool isCommit, TransactionId xid);
+extern void AtEOSubXact_on_commit_actions(bool isCommit,
+ TransactionId childXid,
+ TransactionId parentXid);
#endif /* TABLECMDS_H */
diff --git a/src/include/commands/trigger.h b/src/include/commands/trigger.h
index 9083c1395f..f9e4b2a396 100644
--- a/src/include/commands/trigger.h
+++ b/src/include/commands/trigger.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/commands/trigger.h,v 1.45 2003/11/29 22:40:59 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/commands/trigger.h,v 1.46 2004/07/01 00:51:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -151,44 +151,12 @@ extern void ExecARUpdateTriggers(EState *estate,
ItemPointer tupleid,
HeapTuple newtuple);
-
-/*
- * Deferred trigger stuff
- */
-typedef struct DeferredTriggerStatusData
-{
- Oid dts_tgoid;
- bool dts_tgisdeferred;
-} DeferredTriggerStatusData;
-
-typedef struct DeferredTriggerStatusData *DeferredTriggerStatus;
-
-typedef struct DeferredTriggerEventItem
-{
- Oid dti_tgoid;
- int32 dti_state;
-} DeferredTriggerEventItem;
-
-typedef struct DeferredTriggerEventData *DeferredTriggerEvent;
-
-typedef struct DeferredTriggerEventData
-{
- DeferredTriggerEvent dte_next; /* list link */
- int32 dte_event;
- Oid dte_relid;
- ItemPointerData dte_oldctid;
- ItemPointerData dte_newctid;
- int32 dte_n_items;
- /* dte_item is actually a variable-size array, of length dte_n_items */
- DeferredTriggerEventItem dte_item[1];
-} DeferredTriggerEventData;
-
-
-extern void DeferredTriggerInit(void);
extern void DeferredTriggerBeginXact(void);
extern void DeferredTriggerEndQuery(void);
extern void DeferredTriggerEndXact(void);
extern void DeferredTriggerAbortXact(void);
+extern void DeferredTriggerBeginSubXact(void);
+extern void DeferredTriggerEndSubXact(bool isCommit);
extern void DeferredTriggerSetState(ConstraintsSetStmt *stmt);
diff --git a/src/include/executor/spi.h b/src/include/executor/spi.h
index 2e477e70f8..e283b55cec 100644
--- a/src/include/executor/spi.h
+++ b/src/include/executor/spi.h
@@ -2,7 +2,7 @@
*
* spi.h
*
- * $PostgreSQL: pgsql/src/include/executor/spi.h,v 1.44 2004/04/01 21:28:46 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/executor/spi.h,v 1.45 2004/07/01 00:51:41 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -119,5 +119,6 @@ extern void SPI_cursor_move(Portal portal, bool forward, int count);
extern void SPI_cursor_close(Portal portal);
extern void AtEOXact_SPI(bool isCommit);
+extern void AtEOSubXact_SPI(bool isCommit, TransactionId childXid);
#endif /* SPI_H */
diff --git a/src/include/executor/spi_priv.h b/src/include/executor/spi_priv.h
index dcafa1ccb9..2785f6fe28 100644
--- a/src/include/executor/spi_priv.h
+++ b/src/include/executor/spi_priv.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/executor/spi_priv.h,v 1.18 2004/03/21 22:29:11 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/executor/spi_priv.h,v 1.19 2004/07/01 00:51:42 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,6 +23,7 @@ typedef struct
MemoryContext procCxt; /* procedure context */
MemoryContext execCxt; /* executor context */
MemoryContext savedcxt;
+ TransactionId connectXid; /* Xid of connecting transaction */
} _SPI_connection;
typedef struct
diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h
index 7defaf93f8..e992751f85 100644
--- a/src/include/storage/bufmgr.h
+++ b/src/include/storage/bufmgr.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/storage/bufmgr.h,v 1.82 2004/05/31 19:24:05 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/storage/bufmgr.h,v 1.83 2004/07/01 00:51:43 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -148,6 +148,8 @@ extern void InitBufferPoolAccess(void);
extern char *ShowBufferUsage(void);
extern void ResetBufferUsage(void);
extern void AtEOXact_Buffers(bool isCommit);
+extern void AtSubStart_Buffers(void);
+extern void AtEOSubXact_Buffers(bool isCommit);
extern void FlushBufferPool(void);
extern BlockNumber BufferGetBlockNumber(Buffer buffer);
extern BlockNumber RelationGetNumberOfBlocks(Relation relation);
diff --git a/src/include/storage/bufpage.h b/src/include/storage/bufpage.h
index 5f8012e0ed..727ec508a3 100644
--- a/src/include/storage/bufpage.h
+++ b/src/include/storage/bufpage.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/storage/bufpage.h,v 1.58 2004/06/05 17:42:46 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/storage/bufpage.h,v 1.59 2004/07/01 00:51:43 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -126,10 +126,11 @@ typedef struct PageHeaderData
typedef PageHeaderData *PageHeader;
/*
- * Page layout version number 0 is for pre-7.3 Postgres releases. The
- * current version number is 1, denoting a new HeapTupleHeader layout.
+ * Page layout version number 0 is for pre-7.3 Postgres releases.
+ * Releases 7.3 and 7.4 use 1, denoting a new HeapTupleHeader layout.
+ * Release 7.5 changed the HeapTupleHeader layout again.
*/
-#define PG_PAGE_LAYOUT_VERSION 1
+#define PG_PAGE_LAYOUT_VERSION 2
/* ----------------------------------------------------------------
diff --git a/src/include/storage/lock.h b/src/include/storage/lock.h
index 8c7159c0cb..650b326949 100644
--- a/src/include/storage/lock.h
+++ b/src/include/storage/lock.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/storage/lock.h,v 1.77 2004/05/28 05:13:29 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/storage/lock.h,v 1.78 2004/07/01 00:51:43 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -26,6 +26,14 @@ typedef struct PROC_QUEUE
int size; /* number of entries in list */
} PROC_QUEUE;
+/* Release options for LockReleaseAll */
+typedef enum
+{
+ ReleaseAll, /* All my locks */
+ ReleaseAllExceptSession, /* All except session locks (Xid = 0) */
+ ReleaseGivenXids /* Only locks with Xids in given array */
+} LockReleaseWhich;
+
/* struct PGPROC is declared in storage/proc.h, but must forward-reference it */
typedef struct PGPROC PGPROC;
@@ -165,11 +173,12 @@ typedef struct LOCK
*
* There are two possible kinds of proclock tags: a transaction (identified
* both by the PGPROC of the backend running it, and the xact's own ID) and
- * a session (identified by backend PGPROC, with xid = InvalidTransactionId).
+ * a session (identified by backend PGPROC, with XID = InvalidTransactionId).
*
* Currently, session proclocks are used for user locks and for cross-xact
- * locks obtained for VACUUM. We assume that a session lock never conflicts
- * with per-transaction locks obtained by the same backend.
+ * locks obtained for VACUUM. Note that a single backend can hold locks
+ * under several different XIDs at once (including session locks). We treat
+ * such locks as never conflicting (a backend can never block itself).
*
* The holding[] array counts the granted locks (of each type) represented
* by this proclock. Note that there will be a proclock object, possibly with
@@ -177,11 +186,11 @@ typedef struct LOCK
* Otherwise, proclock objects whose counts have gone to zero are recycled
* as soon as convenient.
*
- * Each PROCLOCK object is linked into lists for both the associated LOCK object
- * and the owning PGPROC object. Note that the PROCLOCK is entered into these
- * lists as soon as it is created, even if no lock has yet been granted.
- * A PGPROC that is waiting for a lock to be granted will also be linked into
- * the lock's waitProcs queue.
+ * Each PROCLOCK object is linked into lists for both the associated LOCK
+ * object and the owning PGPROC object. Note that the PROCLOCK is entered
+ * into these lists as soon as it is created, even if no lock has yet been
+ * granted. A PGPROC that is waiting for a lock to be granted will also be
+ * linked into the lock's waitProcs queue.
*/
typedef struct PROCLOCKTAG
{
@@ -239,7 +248,7 @@ extern bool LockAcquire(LOCKMETHODID lockmethodid, LOCKTAG *locktag,
extern bool LockRelease(LOCKMETHODID lockmethodid, LOCKTAG *locktag,
TransactionId xid, LOCKMODE lockmode);
extern bool LockReleaseAll(LOCKMETHODID lockmethodid, PGPROC *proc,
- bool allxids, TransactionId xid);
+ LockReleaseWhich which, int nxids, TransactionId *xids);
extern int LockCheckConflicts(LockMethod lockMethodTable,
LOCKMODE lockmode,
LOCK *lock, PROCLOCK *proclock, PGPROC *proc,
diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h
index c7283f374c..1551d7568c 100644
--- a/src/include/storage/proc.h
+++ b/src/include/storage/proc.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/storage/proc.h,v 1.67 2003/12/01 21:59:25 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/storage/proc.h,v 1.68 2004/07/01 00:51:43 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -103,7 +103,8 @@ extern int ProcGlobalSemas(int maxBackends);
extern void InitProcGlobal(int maxBackends);
extern void InitProcess(void);
extern void InitDummyProcess(int proctype);
-extern void ProcReleaseLocks(bool isCommit);
+extern void ProcReleaseLocks(LockReleaseWhich which,
+ int nxids, TransactionId *xids);
extern void ProcQueueInit(PROC_QUEUE *queue);
extern int ProcSleep(LockMethod lockMethodTable, LOCKMODE lockmode,
diff --git a/src/include/storage/smgr.h b/src/include/storage/smgr.h
index 52040432dc..e4f0930ef7 100644
--- a/src/include/storage/smgr.h
+++ b/src/include/storage/smgr.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/storage/smgr.h,v 1.44 2004/06/02 17:28:18 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/storage/smgr.h,v 1.45 2004/07/01 00:51:43 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -66,6 +66,9 @@ extern BlockNumber smgrtruncate(SMgrRelation reln, BlockNumber nblocks,
extern void smgrimmedsync(SMgrRelation reln);
extern void smgrDoPendingDeletes(bool isCommit);
extern int smgrGetPendingDeletes(bool forCommit, RelFileNode **ptr);
+extern void AtSubStart_smgr(void);
+extern void AtSubCommit_smgr(void);
+extern void AtSubAbort_smgr(void);
extern void smgrcommit(void);
extern void smgrabort(void);
extern void smgrsync(void);
diff --git a/src/include/utils/catcache.h b/src/include/utils/catcache.h
index 9c8d3053fe..3ce54b99a2 100644
--- a/src/include/utils/catcache.h
+++ b/src/include/utils/catcache.h
@@ -13,7 +13,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/catcache.h,v 1.48 2003/11/29 22:41:15 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/utils/catcache.h,v 1.49 2004/07/01 00:51:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -101,6 +101,9 @@ typedef struct catctup
* and negative entries is identical.
*/
int refcount; /* number of active references */
+ int *prev_refcount; /* refcounts for upper subtransactions */
+ int numpushes; /* number of used refcounts in the array */
+ int numalloc; /* allocated size of array */
bool dead; /* dead but not yet removed? */
bool negative; /* negative cache entry? */
uint32 hash_value; /* hash value for this tuple's keys */
@@ -139,6 +142,9 @@ typedef struct catclist
*/
Dlelem cache_elem; /* list member of per-catcache list */
int refcount; /* number of active references */
+ int *prev_refcount; /* refcounts for upper subtransactions */
+ int numpushes; /* number of used refcounts in the array */
+ int numalloc; /* allocated size of array */
bool dead; /* dead but not yet removed? */
bool ordered; /* members listed in index order? */
short nkeys; /* number of lookup keys specified */
@@ -163,6 +169,8 @@ extern DLLIMPORT MemoryContext CacheMemoryContext;
extern void CreateCacheMemoryContext(void);
extern void AtEOXact_CatCache(bool isCommit);
+extern void AtSubStart_CatCache(void);
+extern void AtEOSubXact_CatCache(bool isCommit);
extern CatCache *InitCatCache(int id, const char *relname, const char *indname,
int reloidattr,
diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h
index b91682af88..0a510cd665 100644
--- a/src/include/utils/guc.h
+++ b/src/include/utils/guc.h
@@ -7,7 +7,7 @@
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
- * $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.47 2004/05/28 05:13:32 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.48 2004/07/01 00:51:44 tgl Exp $
*--------------------------------------------------------------------
*/
#ifndef GUC_H
@@ -175,14 +175,14 @@ extern void DefineCustomStringVariable(
GucStringAssignHook assign_hook,
GucShowHook show_hook);
-extern void EmittWarningsOnPlaceholders(const char* className);
+extern void EmitWarningsOnPlaceholders(const char* className);
extern const char *GetConfigOption(const char *name);
extern const char *GetConfigOptionResetString(const char *name);
extern void ProcessConfigFile(GucContext context);
extern void InitializeGUCOptions(void);
extern void ResetAllOptions(void);
-extern void AtEOXact_GUC(bool isCommit);
+extern void AtEOXact_GUC(bool isCommit, bool isSubXact);
extern void BeginReportingGUCOptions(void);
extern void ParseLongOption(const char *string, char **name, char **value);
extern bool set_config_option(const char *name, const char *value,
diff --git a/src/include/utils/guc_tables.h b/src/include/utils/guc_tables.h
index 62d2d571b2..d522f6d5e9 100644
--- a/src/include/utils/guc_tables.h
+++ b/src/include/utils/guc_tables.h
@@ -7,12 +7,31 @@
*
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/include/utils/guc_tables.h,v 1.11 2004/05/26 15:07:41 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/utils/guc_tables.h,v 1.12 2004/07/01 00:51:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
-#ifndef GUC_TABLES
-#define GUC_TABLES 1
+#ifndef GUC_TABLES_H
+#define GUC_TABLES_H 1
+
+/*
+ * GUC supports these types of variables:
+ */
+enum config_type
+{
+ PGC_BOOL,
+ PGC_INT,
+ PGC_REAL,
+ PGC_STRING
+};
+
+union config_var_value
+{
+ bool boolval;
+ int intval;
+ double realval;
+ char *stringval;
+};
/*
* Groupings to help organize all the run-time options for display
@@ -56,15 +75,19 @@ enum config_group
};
/*
- * GUC supports these types of variables:
+ * Stack entry for saving the state of a variable prior to the current
+ * transaction
*/
-enum config_type
+typedef struct guc_stack
{
- PGC_BOOL,
- PGC_INT,
- PGC_REAL,
- PGC_STRING
-};
+ struct guc_stack *prev; /* previous stack item, if any */
+ int nest_level; /* nesting depth of cur transaction */
+ int status; /* previous status bits, see below */
+ GucSource tentative_source; /* source of the tentative_value */
+ GucSource source; /* source of the actual value */
+ union config_var_value tentative_val; /* previous tentative val */
+ union config_var_value value; /* previous actual value */
+} GucStack;
/*
* Generic fields applicable to all types of variables
@@ -86,9 +109,9 @@ struct config_generic
enum config_type vartype; /* type of variable (set only at startup) */
int status; /* status bits, see below */
GucSource reset_source; /* source of the reset_value */
- GucSource session_source; /* source of the session_value */
GucSource tentative_source; /* source of the tentative_value */
GucSource source; /* source of the current actual value */
+ GucStack *stack; /* stacked outside-of-transaction states */
};
/* bit values in flags field */
@@ -104,6 +127,7 @@ struct config_generic
/* bit values in status field */
#define GUC_HAVE_TENTATIVE 0x0001 /* tentative value is defined */
#define GUC_HAVE_LOCAL 0x0002 /* a SET LOCAL has been executed */
+#define GUC_HAVE_STACK 0x0004 /* we have stacked prior value(s) */
/* GUC records for specific variable types */
@@ -118,7 +142,6 @@ struct config_bool
GucBoolAssignHook assign_hook;
GucShowHook show_hook;
/* variable fields, initialized at runtime: */
- bool session_val;
bool tentative_val;
};
@@ -134,7 +157,6 @@ struct config_int
GucIntAssignHook assign_hook;
GucShowHook show_hook;
/* variable fields, initialized at runtime: */
- int session_val;
int tentative_val;
};
@@ -150,7 +172,6 @@ struct config_real
GucRealAssignHook assign_hook;
GucShowHook show_hook;
/* variable fields, initialized at runtime: */
- double session_val;
double tentative_val;
};
@@ -165,7 +186,6 @@ struct config_string
GucShowHook show_hook;
/* variable fields, initialized at runtime: */
char *reset_val;
- char *session_val;
char *tentative_val;
};
@@ -180,4 +200,4 @@ extern struct config_generic **get_guc_variables(void);
extern void build_guc_variables(void);
-#endif
+#endif /* GUC_TABLES_H */
diff --git a/src/include/utils/inval.h b/src/include/utils/inval.h
index a2bad9cd06..add5ca83c7 100644
--- a/src/include/utils/inval.h
+++ b/src/include/utils/inval.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/inval.h,v 1.31 2004/05/06 16:10:57 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/utils/inval.h,v 1.32 2004/07/01 00:51:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -22,9 +22,15 @@ typedef void (*CacheCallbackFunction) (Datum arg, Oid relid);
extern void AcceptInvalidationMessages(void);
-extern void AtEOXactInvalidationMessages(bool isCommit);
+extern void AtStart_Inval(void);
-extern void CommandEndInvalidationMessages(bool isCommit);
+extern void AtSubStart_Inval(void);
+
+extern void AtEOXact_Inval(bool isCommit);
+
+extern void AtSubEOXact_Inval(bool isCommit);
+
+extern void CommandEndInvalidationMessages(void);
extern void CacheInvalidateHeapTuple(Relation relation, HeapTuple tuple);
diff --git a/src/include/utils/memutils.h b/src/include/utils/memutils.h
index 7865859c06..d2d7d4a909 100644
--- a/src/include/utils/memutils.h
+++ b/src/include/utils/memutils.h
@@ -10,7 +10,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/memutils.h,v 1.55 2004/06/05 19:48:09 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/utils/memutils.h,v 1.56 2004/07/01 00:51:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -73,6 +73,7 @@ extern DLLIMPORT MemoryContext PostmasterContext;
extern DLLIMPORT MemoryContext CacheMemoryContext;
extern DLLIMPORT MemoryContext MessageContext;
extern DLLIMPORT MemoryContext TopTransactionContext;
+extern DLLIMPORT MemoryContext CurTransactionContext;
/* These two are transient links to contexts owned by other objects: */
extern DLLIMPORT MemoryContext QueryContext;
diff --git a/src/include/utils/portal.h b/src/include/utils/portal.h
index 2819295e83..3437dc448a 100644
--- a/src/include/utils/portal.h
+++ b/src/include/utils/portal.h
@@ -39,7 +39,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/portal.h,v 1.48 2003/11/29 22:41:16 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/utils/portal.h,v 1.49 2004/07/01 00:51:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -167,6 +167,9 @@ extern void EnablePortalManager(void);
extern void AtCommit_Portals(void);
extern void AtAbort_Portals(void);
extern void AtCleanup_Portals(void);
+extern void AtSubCommit_Portals(TransactionId parentXid);
+extern void AtSubAbort_Portals(void);
+extern void AtSubCleanup_Portals(void);
extern Portal CreatePortal(const char *name, bool allowDup, bool dupSilent);
extern Portal CreateNewPortal(void);
extern void PortalDrop(Portal portal, bool isError);
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index e5008e56ea..b7f85eda68 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/rel.h,v 1.74 2004/05/08 19:09:25 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/utils/rel.h,v 1.75 2004/07/01 00:51:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -110,6 +110,9 @@ typedef struct RelationData
BlockNumber rd_targblock; /* current insertion target block, or
* InvalidBlockNumber */
int rd_refcnt; /* reference count */
+ int *rd_prevrefcnt; /* reference count stack */
+ int rd_numalloc; /* stack allocated size */
+ int rd_numpushed; /* stack used size */
bool rd_isnew; /* rel was created in current xact */
/*
diff --git a/src/include/utils/relcache.h b/src/include/utils/relcache.h
index da82f4f613..47f46190df 100644
--- a/src/include/utils/relcache.h
+++ b/src/include/utils/relcache.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/relcache.h,v 1.40 2004/06/18 06:14:21 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/utils/relcache.h,v 1.41 2004/07/01 00:51:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -65,7 +65,9 @@ extern void RelationCacheInvalidateEntry(Oid relationId, RelFileNode *rnode);
extern void RelationCacheInvalidate(void);
-extern void AtEOXact_RelationCache(bool commit);
+extern void AtEOXact_RelationCache(bool isCommit);
+extern void AtSubStart_RelationCache(void);
+extern void AtEOSubXact_RelationCache(bool isCommit);
/*
* Routines to help manage rebuilding of relcache init file