diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/access/xact.h | 23 | ||||
-rw-r--r-- | src/include/c.h | 9 | ||||
-rw-r--r-- | src/include/catalog/namespace.h | 6 | ||||
-rw-r--r-- | src/include/commands/tablecmds.h | 8 | ||||
-rw-r--r-- | src/include/commands/user.h | 7 | ||||
-rw-r--r-- | src/include/executor/spi.h | 4 | ||||
-rw-r--r-- | src/include/executor/spi_priv.h | 4 | ||||
-rw-r--r-- | src/include/libpq/be-fsstubs.h | 6 | ||||
-rw-r--r-- | src/include/storage/fd.h | 6 | ||||
-rw-r--r-- | src/include/storage/large_object.h | 6 | ||||
-rw-r--r-- | src/include/storage/lmgr.h | 3 | ||||
-rw-r--r-- | src/include/utils/portal.h | 20 | ||||
-rw-r--r-- | src/include/utils/rel.h | 11 | ||||
-rw-r--r-- | src/include/utils/relcache.h | 6 |
14 files changed, 72 insertions, 47 deletions
diff --git a/src/include/access/xact.h b/src/include/access/xact.h index c30c741f27e..9fa6a1d2406 100644 --- a/src/include/access/xact.h +++ b/src/include/access/xact.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/xact.h,v 1.72 2004/09/05 23:01:26 tgl Exp $ + * $PostgreSQL: pgsql/src/include/access/xact.h,v 1.73 2004/09/16 16:58:37 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -46,14 +46,21 @@ extern bool XactReadOnly; */ typedef enum { - XACT_EVENT_ABORT, XACT_EVENT_COMMIT, - XACT_EVENT_START_SUB, - XACT_EVENT_ABORT_SUB, - XACT_EVENT_COMMIT_SUB + XACT_EVENT_ABORT } XactEvent; -typedef void (*XactCallback) (XactEvent event, TransactionId parentXid, void *arg); +typedef void (*XactCallback) (XactEvent event, void *arg); + +typedef enum +{ + SUBXACT_EVENT_START_SUB, + SUBXACT_EVENT_COMMIT_SUB, + SUBXACT_EVENT_ABORT_SUB +} SubXactEvent; + +typedef void (*SubXactCallback) (SubXactEvent event, SubTransactionId mySubid, + SubTransactionId parentSubid, void *arg); /* ---------------- @@ -101,6 +108,8 @@ extern bool IsTransactionState(void); extern bool IsAbortedTransactionBlockState(void); extern TransactionId GetTopTransactionId(void); extern TransactionId GetCurrentTransactionId(void); +extern TransactionId GetCurrentTransactionIdIfAny(void); +extern SubTransactionId GetCurrentSubTransactionId(void); extern CommandId GetCurrentCommandId(void); extern AbsoluteTime GetCurrentTransactionStartTime(void); extern AbsoluteTime GetCurrentTransactionStartTimeUsec(int *usec); @@ -129,6 +138,8 @@ extern void RequireTransactionChain(void *stmtNode, const char *stmtType); extern bool IsInTransactionChain(void *stmtNode); extern void RegisterXactCallback(XactCallback callback, void *arg); extern void UnregisterXactCallback(XactCallback callback, void *arg); +extern void RegisterSubXactCallback(SubXactCallback callback, void *arg); +extern void UnregisterSubXactCallback(SubXactCallback callback, void *arg); extern void RecordTransactionCommit(void); diff --git a/src/include/c.h b/src/include/c.h index 4d295510dcf..cfce57c070a 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -12,7 +12,7 @@ * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/c.h,v 1.171 2004/09/10 15:51:47 momjian Exp $ + * $PostgreSQL: pgsql/src/include/c.h,v 1.172 2004/09/16 16:58:38 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -351,7 +351,7 @@ typedef float float4; typedef double float8; /* - * Oid, RegProcedure, TransactionId, CommandId, AclId + * Oid, RegProcedure, TransactionId, SubTransactionId, CommandId, AclId */ /* typedef Oid is in postgres_ext.h */ @@ -365,6 +365,11 @@ typedef regproc RegProcedure; typedef uint32 TransactionId; +typedef uint32 SubTransactionId; + +#define InvalidSubTransactionId ((SubTransactionId) 0) +#define TopSubTransactionId ((SubTransactionId) 1) + typedef uint32 CommandId; #define FirstCommandId ((CommandId) 0) diff --git a/src/include/catalog/namespace.h b/src/include/catalog/namespace.h index 01d40c89d0c..f1badb5d73e 100644 --- a/src/include/catalog/namespace.h +++ b/src/include/catalog/namespace.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/namespace.h,v 1.33 2004/08/29 05:06:55 momjian Exp $ + * $PostgreSQL: pgsql/src/include/catalog/namespace.h,v 1.34 2004/09/16 16:58:39 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -91,8 +91,8 @@ extern Oid FindDefaultConversionProc(int4 for_encoding, int4 to_encoding); /* initialization & transaction cleanup code */ extern void InitializeSearchPath(void); extern void AtEOXact_Namespace(bool isCommit); -extern void AtEOSubXact_Namespace(bool isCommit, TransactionId myXid, - TransactionId parentXid); +extern void AtEOSubXact_Namespace(bool isCommit, SubTransactionId mySubid, + SubTransactionId parentSubid); /* stuff for search_path GUC variable */ extern char *namespace_search_path; diff --git a/src/include/commands/tablecmds.h b/src/include/commands/tablecmds.h index e33552fb4e4..b51dda8227b 100644 --- a/src/include/commands/tablecmds.h +++ b/src/include/commands/tablecmds.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/tablecmds.h,v 1.19 2004/08/29 05:06:56 momjian Exp $ + * $PostgreSQL: pgsql/src/include/commands/tablecmds.h,v 1.20 2004/09/16 16:58:39 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -42,9 +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, TransactionId xid); +extern void AtEOXact_on_commit_actions(bool isCommit); extern void AtEOSubXact_on_commit_actions(bool isCommit, - TransactionId childXid, - TransactionId parentXid); + SubTransactionId mySubid, + SubTransactionId parentSubid); #endif /* TABLECMDS_H */ diff --git a/src/include/commands/user.h b/src/include/commands/user.h index 2d51b1212ab..882b0efc219 100644 --- a/src/include/commands/user.h +++ b/src/include/commands/user.h @@ -4,7 +4,7 @@ * Commands for manipulating users and groups. * * - * $PostgreSQL: pgsql/src/include/commands/user.h,v 1.24 2004/08/29 05:06:56 momjian Exp $ + * $PostgreSQL: pgsql/src/include/commands/user.h,v 1.25 2004/09/16 16:58:39 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -32,7 +32,8 @@ extern void RenameGroup(const char *oldname, const char *newname); extern Datum update_pg_pwd_and_pg_group(PG_FUNCTION_ARGS); extern void AtEOXact_UpdatePasswordFile(bool isCommit); -extern void AtEOSubXact_UpdatePasswordFile(bool isCommit, TransactionId myXid, - TransactionId parentXid); +extern void AtEOSubXact_UpdatePasswordFile(bool isCommit, + SubTransactionId mySubid, + SubTransactionId parentSubid); #endif /* USER_H */ diff --git a/src/include/executor/spi.h b/src/include/executor/spi.h index d58f66ad314..3014dbce840 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.48 2004/09/13 20:07:53 tgl Exp $ + * $PostgreSQL: pgsql/src/include/executor/spi.h,v 1.49 2004/09/16 16:58:40 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -126,6 +126,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); +extern void AtEOSubXact_SPI(bool isCommit, SubTransactionId mySubid); #endif /* SPI_H */ diff --git a/src/include/executor/spi_priv.h b/src/include/executor/spi_priv.h index afc686ed8db..045ba5eaa08 100644 --- a/src/include/executor/spi_priv.h +++ b/src/include/executor/spi_priv.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/spi_priv.h,v 1.20 2004/08/29 04:13:07 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/spi_priv.h,v 1.21 2004/09/16 16:58:40 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -23,7 +23,7 @@ typedef struct MemoryContext procCxt; /* procedure context */ MemoryContext execCxt; /* executor context */ MemoryContext savedcxt; - TransactionId connectXid; /* Xid of connecting transaction */ + SubTransactionId connectSubid; /* ID of connecting subtransaction */ } _SPI_connection; typedef struct diff --git a/src/include/libpq/be-fsstubs.h b/src/include/libpq/be-fsstubs.h index 76fca5c2a07..60bd3ab36fa 100644 --- a/src/include/libpq/be-fsstubs.h +++ b/src/include/libpq/be-fsstubs.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/libpq/be-fsstubs.h,v 1.21 2004/08/29 05:06:56 momjian Exp $ + * $PostgreSQL: pgsql/src/include/libpq/be-fsstubs.h,v 1.22 2004/09/16 16:58:41 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -46,7 +46,7 @@ extern int lo_write(int fd, char *buf, int len); * Cleanup LOs at xact commit/abort */ extern void AtEOXact_LargeObject(bool isCommit); -extern void AtEOSubXact_LargeObject(bool isCommit, TransactionId myXid, - TransactionId parentXid); +extern void AtEOSubXact_LargeObject(bool isCommit, SubTransactionId mySubid, + SubTransactionId parentSubid); #endif /* BE_FSSTUBS_H */ diff --git a/src/include/storage/fd.h b/src/include/storage/fd.h index 11ce7f1112b..77951c3ecef 100644 --- a/src/include/storage/fd.h +++ b/src/include/storage/fd.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/fd.h,v 1.48 2004/08/29 05:06:58 momjian Exp $ + * $PostgreSQL: pgsql/src/include/storage/fd.h,v 1.49 2004/09/16 16:58:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -85,8 +85,8 @@ extern int BasicOpenFile(FileName fileName, int fileFlags, int fileMode); extern void set_max_safe_fds(void); extern void closeAllVfds(void); extern void AtEOXact_Files(void); -extern void AtEOSubXact_Files(bool isCommit, TransactionId myXid, - TransactionId parentXid); +extern void AtEOSubXact_Files(bool isCommit, SubTransactionId mySubid, + SubTransactionId parentSubid); extern void RemovePgTempFiles(void); extern int pg_fsync(int fd); extern int pg_fdatasync(int fd); diff --git a/src/include/storage/large_object.h b/src/include/storage/large_object.h index 609bb80459f..b662b3b14cf 100644 --- a/src/include/storage/large_object.h +++ b/src/include/storage/large_object.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/large_object.h,v 1.29 2004/08/29 04:13:10 momjian Exp $ + * $PostgreSQL: pgsql/src/include/storage/large_object.h,v 1.30 2004/09/16 16:58:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -20,7 +20,7 @@ * Data about a currently-open large object. * * id is the logical OID of the large object - * xid is the transaction Id that opened the LO (or currently owns it) + * subid is the subtransaction that opened the LO (or currently owns it) * offset is the current seek offset within the LO * flags contains some flag bits * @@ -32,7 +32,7 @@ typedef struct LargeObjectDesc { Oid id; /* LO's identifier */ - TransactionId xid; /* owning XID */ + SubTransactionId subid; /* owning subtransaction ID */ uint32 offset; /* current seek pointer */ int flags; /* locking info, etc */ diff --git a/src/include/storage/lmgr.h b/src/include/storage/lmgr.h index d9f8ff36830..63281418808 100644 --- a/src/include/storage/lmgr.h +++ b/src/include/storage/lmgr.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/lmgr.h,v 1.43 2004/08/29 04:13:10 momjian Exp $ + * $PostgreSQL: pgsql/src/include/storage/lmgr.h,v 1.44 2004/09/16 16:58:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -58,6 +58,7 @@ extern void UnlockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode); /* Lock an XID (used to wait for a transaction to finish) */ extern void XactLockTableInsert(TransactionId xid); +extern void XactLockTableDelete(TransactionId xid); extern void XactLockTableWait(TransactionId xid); #endif /* LMGR_H */ diff --git a/src/include/utils/portal.h b/src/include/utils/portal.h index 4f28fd2fc3c..cdd74e517fd 100644 --- a/src/include/utils/portal.h +++ b/src/include/utils/portal.h @@ -39,7 +39,7 @@ * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/portal.h,v 1.52 2004/08/29 05:06:59 momjian Exp $ + * $PostgreSQL: pgsql/src/include/utils/portal.h,v 1.53 2004/09/16 16:58:43 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -106,7 +106,11 @@ typedef struct PortalData MemoryContext heap; /* subsidiary memory for portal */ ResourceOwner resowner; /* resources owned by portal */ void (*cleanup) (Portal portal); /* cleanup hook */ - TransactionId createXact; /* the xid of the creating xact */ + SubTransactionId createSubid; /* the ID of the creating subxact */ + /* + * if createSubid is InvalidSubTransactionId, the portal is held over + * from a previous transaction + */ /* The query or queries the portal will execute */ const char *sourceText; /* text of query, if known (may be NULL) */ @@ -181,11 +185,13 @@ 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, - ResourceOwner parentXactOwner); -extern void AtSubAbort_Portals(TransactionId parentXid, - ResourceOwner parentXactOwner); -extern void AtSubCleanup_Portals(void); +extern void AtSubCommit_Portals(SubTransactionId mySubid, + SubTransactionId parentSubid, + ResourceOwner parentXactOwner); +extern void AtSubAbort_Portals(SubTransactionId mySubid, + SubTransactionId parentSubid, + ResourceOwner parentXactOwner); +extern void AtSubCleanup_Portals(SubTransactionId mySubid); extern Portal CreatePortal(const char *name, bool allowDup, bool dupSilent); extern Portal CreateNewPortal(void); extern void PortalDrop(Portal portal, bool isTopCommit); diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h index 2875efac6fa..adcd82a9c9e 100644 --- a/src/include/utils/rel.h +++ b/src/include/utils/rel.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/rel.h,v 1.79 2004/08/29 05:06:59 momjian Exp $ + * $PostgreSQL: pgsql/src/include/utils/rel.h,v 1.80 2004/09/16 16:58:43 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -115,12 +115,12 @@ typedef struct RelationData bool rd_isvalid; /* relcache entry is valid */ char rd_indexvalid; /* state of rd_indexlist: 0 = not valid, 1 * = valid, 2 = temporarily forced */ - TransactionId rd_createxact; /* rel was created in current xact */ + SubTransactionId rd_createSubid; /* rel was created in current xact */ /* - * rd_createxact is the XID of the highest subtransaction the rel has + * rd_createSubid is the ID of the highest subtransaction the rel has * survived into; or zero if the rel was not created in the current - * transaction. This should be relied on only for optimization + * top transaction. This should be relied on only for optimization * purposes; it is possible for new-ness to be "forgotten" (eg, after * CLUSTER). */ @@ -241,7 +241,8 @@ typedef Relation *RelationPtr; * Beware of multiple eval of argument */ #define RELATION_IS_LOCAL(relation) \ - ((relation)->rd_istemp || TransactionIdIsValid((relation)->rd_createxact)) + ((relation)->rd_istemp || \ + (relation)->rd_createSubid != InvalidSubTransactionId) /* routines in utils/cache/relcache.c */ extern void RelationIncrementReferenceCount(Relation rel); diff --git a/src/include/utils/relcache.h b/src/include/utils/relcache.h index 20809d0fd4c..0ef021a3aac 100644 --- a/src/include/utils/relcache.h +++ b/src/include/utils/relcache.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/relcache.h,v 1.45 2004/08/29 05:06:59 momjian Exp $ + * $PostgreSQL: pgsql/src/include/utils/relcache.h,v 1.46 2004/09/16 16:58:43 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -66,8 +66,8 @@ extern void RelationCacheInvalidateEntry(Oid relationId, RelFileNode *rnode); extern void RelationCacheInvalidate(void); extern void AtEOXact_RelationCache(bool isCommit); -extern void AtEOSubXact_RelationCache(bool isCommit, TransactionId myXid, - TransactionId parentXid); +extern void AtEOSubXact_RelationCache(bool isCommit, SubTransactionId mySubid, + SubTransactionId parentSubid); /* * Routines to help manage rebuilding of relcache init file |