diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2004-07-28 14:23:31 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2004-07-28 14:23:31 +0000 |
commit | 1bf3d615047eb214b1ddde31bd268dabf96cc3fa (patch) | |
tree | 0fdb8cc0a4203c338b6f73130c9ef74b64d4a74e /src/include | |
parent | cc813fc2b8d9293bbd4d0e0d6a6f3b9cf02fe32f (diff) | |
download | postgresql-1bf3d615047eb214b1ddde31bd268dabf96cc3fa.tar.gz |
Fix subtransaction behavior for large objects, temp namespace, files,
password/group files. Also allow read-only subtransactions of a read-write
parent, but not vice versa. These are the reasonably noncontroversial
parts of Alvaro's recent mop-up patch, plus further work on large objects
to minimize use of the TopTransactionResourceOwner.
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/catalog/namespace.h | 4 | ||||
-rw-r--r-- | src/include/commands/user.h | 4 | ||||
-rw-r--r-- | src/include/libpq/be-fsstubs.h | 8 | ||||
-rw-r--r-- | src/include/storage/fd.h | 4 | ||||
-rw-r--r-- | src/include/storage/large_object.h | 22 | ||||
-rw-r--r-- | src/include/utils/inval.h | 4 |
6 files changed, 26 insertions, 20 deletions
diff --git a/src/include/catalog/namespace.h b/src/include/catalog/namespace.h index 7a0cfd7099..986a26b96f 100644 --- a/src/include/catalog/namespace.h +++ b/src/include/catalog/namespace.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/catalog/namespace.h,v 1.30 2004/01/19 19:04:40 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/namespace.h,v 1.31 2004/07/28 14:23:30 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -91,6 +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); /* stuff for search_path GUC variable */ extern char *namespace_search_path; diff --git a/src/include/commands/user.h b/src/include/commands/user.h index 8dba146aa5..7a72319277 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.22 2003/11/29 22:40:59 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/commands/user.h,v 1.23 2004/07/28 14:23:31 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -32,5 +32,7 @@ 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); #endif /* USER_H */ diff --git a/src/include/libpq/be-fsstubs.h b/src/include/libpq/be-fsstubs.h index 9c45876be5..b2d8b3d340 100644 --- a/src/include/libpq/be-fsstubs.h +++ b/src/include/libpq/be-fsstubs.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/libpq/be-fsstubs.h,v 1.18 2003/11/29 22:41:03 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/libpq/be-fsstubs.h,v 1.19 2004/07/28 14:23:31 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -43,8 +43,10 @@ extern int lo_read(int fd, char *buf, int len); extern int lo_write(int fd, char *buf, int len); /* - * Cleanup LOs at xact commit/abort [ Pascal André <andre@via.ecp.fr> ] + * Cleanup LOs at xact commit/abort */ -extern void lo_commit(bool isCommit); +extern void AtEOXact_LargeObject(bool isCommit); +extern void AtEOSubXact_LargeObject(bool isCommit, TransactionId myXid, + TransactionId parentXid); #endif /* BE_FSSTUBS_H */ diff --git a/src/include/storage/fd.h b/src/include/storage/fd.h index 430ed5d8c7..c62f6fff76 100644 --- a/src/include/storage/fd.h +++ b/src/include/storage/fd.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/fd.h,v 1.45 2004/05/31 03:48:10 tgl Exp $ + * $PostgreSQL: pgsql/src/include/storage/fd.h,v 1.46 2004/07/28 14:23:31 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -85,6 +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 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 23118aaf5a..164d3abb5d 100644 --- a/src/include/storage/large_object.h +++ b/src/include/storage/large_object.h @@ -1,47 +1,44 @@ /*------------------------------------------------------------------------- * * large_object.h - * file of info for Postgres large objects. POSTGRES 4.2 supports + * Declarations for PostgreSQL large objects. POSTGRES 4.2 supported * zillions of large objects (internal, external, jaquith, inversion). * Now we only support inversion. * * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/large_object.h,v 1.27 2003/11/29 22:41:13 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/storage/large_object.h,v 1.28 2004/07/28 14:23:31 tgl Exp $ * *------------------------------------------------------------------------- */ #ifndef LARGE_OBJECT_H #define LARGE_OBJECT_H -#include "utils/rel.h" - /*---------- * 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) * offset is the current seek offset within the LO - * heap_r holds an open-relation reference to pg_largeobject - * index_r holds an open-relation reference to pg_largeobject_loid_pn_index + * flags contains some flag bits * - * NOTE: before 7.1, heap_r and index_r held references to the separate - * table and index of a specific large object. Now they all live in one rel. + * NOTE: before 7.1, we also had to store references to the separate table + * and index of a specific large object. Now they all live in pg_largeobject + * and are accessed via a common relation descriptor. *---------- */ typedef struct LargeObjectDesc { - Oid id; + Oid id; /* LO's identifier */ + TransactionId xid; /* owning XID */ uint32 offset; /* current seek pointer */ int flags; /* locking info, etc */ /* flag bits: */ #define IFS_RDLOCK (1 << 0) #define IFS_WRLOCK (1 << 1) - - Relation heap_r; - Relation index_r; } LargeObjectDesc; @@ -67,6 +64,7 @@ typedef struct LargeObjectDesc */ /* inversion stuff in inv_api.c */ +extern void close_lo_relation(bool isCommit); extern LargeObjectDesc *inv_create(int flags); extern LargeObjectDesc *inv_open(Oid lobjId, int flags); extern void inv_close(LargeObjectDesc *obj_desc); diff --git a/src/include/utils/inval.h b/src/include/utils/inval.h index add5ca83c7..cf12122ea5 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.32 2004/07/01 00:51:44 tgl Exp $ + * $PostgreSQL: pgsql/src/include/utils/inval.h,v 1.33 2004/07/28 14:23:31 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -28,7 +28,7 @@ extern void AtSubStart_Inval(void); extern void AtEOXact_Inval(bool isCommit); -extern void AtSubEOXact_Inval(bool isCommit); +extern void AtEOSubXact_Inval(bool isCommit); extern void CommandEndInvalidationMessages(void); |