diff options
author | Robert Haas <rhaas@postgresql.org> | 2010-08-13 20:10:54 +0000 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2010-08-13 20:10:54 +0000 |
commit | debcec7dc31a992703911a9953e299c8d730c778 (patch) | |
tree | dad0d10ec39eafe0cc254c17e36eb82ec822cdac /src/include/utils/rel.h | |
parent | 3f9479ef3fdf49fc22088be5268fa536cf5d4efd (diff) | |
download | postgresql-debcec7dc31a992703911a9953e299c8d730c778.tar.gz postgresql-debcec7dc31a992703911a9953e299c8d730c778.zip |
Include the backend ID in the relpath of temporary relations.
This allows us to reliably remove all leftover temporary relation
files on cluster startup without reference to system catalogs or WAL;
therefore, we no longer include temporary relations in XLOG_XACT_COMMIT
and XLOG_XACT_ABORT WAL records.
Since these changes require including a backend ID in each
SharedInvalSmgrMsg, the size of the SharedInvalidationMessage.id
field has been reduced from two bytes to one, and the maximum number
of connections has been reduced from INT_MAX / 4 to 2^23-1. It would
be possible to remove these restrictions by increasing the size of
SharedInvalidationMessage by 4 bytes, but right now that doesn't seem
like a good trade-off.
Review by Jaime Casanova and Tom Lane.
Diffstat (limited to 'src/include/utils/rel.h')
-rw-r--r-- | src/include/utils/rel.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h index a0a9b301c4a..b615f81c651 100644 --- a/src/include/utils/rel.h +++ b/src/include/utils/rel.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/rel.h,v 1.124 2010/02/26 02:01:29 momjian Exp $ + * $PostgreSQL: pgsql/src/include/utils/rel.h,v 1.125 2010/08/13 20:10:54 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -126,8 +126,8 @@ typedef struct RelationData /* use "struct" here to avoid needing to include smgr.h: */ struct SMgrRelationData *rd_smgr; /* cached file handle, or NULL */ int rd_refcnt; /* reference count */ + BackendId rd_backend; /* owning backend id, if temporary relation */ bool rd_istemp; /* rel is a temporary relation */ - bool rd_islocaltemp; /* rel is a temp rel of this session */ bool rd_isnailed; /* rel is nailed in cache */ bool rd_isvalid; /* relcache entry is valid */ char rd_indexvalid; /* state of rd_indexlist: 0 = not valid, 1 = @@ -347,7 +347,7 @@ typedef struct StdRdOptions #define RelationOpenSmgr(relation) \ do { \ if ((relation)->rd_smgr == NULL) \ - smgrsetowner(&((relation)->rd_smgr), smgropen((relation)->rd_node)); \ + smgrsetowner(&((relation)->rd_smgr), smgropen((relation)->rd_node, (relation)->rd_backend)); \ } while (0) /* @@ -393,7 +393,7 @@ typedef struct StdRdOptions * Beware of multiple eval of argument */ #define RELATION_IS_LOCAL(relation) \ - ((relation)->rd_islocaltemp || \ + ((relation)->rd_backend == MyBackendId || \ (relation)->rd_createSubid != InvalidSubTransactionId) /* @@ -403,7 +403,7 @@ typedef struct StdRdOptions * Beware of multiple eval of argument */ #define RELATION_IS_OTHER_TEMP(relation) \ - ((relation)->rd_istemp && !(relation)->rd_islocaltemp) + ((relation)->rd_istemp && (relation)->rd_backend != MyBackendId) /* routines in utils/cache/relcache.c */ extern void RelationIncrementReferenceCount(Relation rel); |