mirror of
https://github.com/postgres/postgres.git
synced 2025-10-28 11:55:03 +03:00
Phase 1 of fix for 'SMgrRelation hashtable corrupted' problem. This
is the minimum required fix. I want to look next at taking advantage of it by simplifying the message semantics in the shared inval message queue, but that part can be held over for 8.1 if it turns out too ugly.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/storage/smgr.h,v 1.49 2004/12/31 22:03:42 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/include/storage/smgr.h,v 1.50 2005/01/10 20:02:23 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -27,12 +27,22 @@
|
||||
* operations imply I/O, they just create or destroy a hashtable entry.
|
||||
* (But smgrclose() may release associated resources, such as OS-level file
|
||||
* descriptors.)
|
||||
*
|
||||
* An SMgrRelation may have an "owner", which is just a pointer to it from
|
||||
* somewhere else; smgr.c will clear this pointer if the SMgrRelation is
|
||||
* closed. We use this to avoid dangling pointers from relcache to smgr
|
||||
* without having to make the smgr explicitly aware of relcache. There
|
||||
* can't be more than one "owner" pointer per SMgrRelation, but that's
|
||||
* all we need.
|
||||
*/
|
||||
typedef struct SMgrRelationData
|
||||
{
|
||||
/* rnode is the hashtable lookup key, so it must be first! */
|
||||
RelFileNode smgr_rnode; /* relation physical identifier */
|
||||
|
||||
/* pointer to owning pointer, or NULL if none */
|
||||
struct SMgrRelationData **smgr_owner;
|
||||
|
||||
/* additional public fields may someday exist here */
|
||||
|
||||
/*
|
||||
@@ -49,6 +59,7 @@ typedef SMgrRelationData *SMgrRelation;
|
||||
|
||||
extern void smgrinit(void);
|
||||
extern SMgrRelation smgropen(RelFileNode rnode);
|
||||
extern void smgrsetowner(SMgrRelation *owner, SMgrRelation reln);
|
||||
extern void smgrclose(SMgrRelation reln);
|
||||
extern void smgrcloseall(void);
|
||||
extern void smgrclosenode(RelFileNode rnode);
|
||||
|
||||
Reference in New Issue
Block a user