From b41f4ab8c448fc1bb13b52d00c9c4f1868d97941 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 30 Jun 2000 07:04:23 +0000 Subject: Use a private memory context to store rule information in each relcache entry that has rules. This allows us to release the rule parsetrees on relcache flush without needing a working freeObject() routine. Formerly, the rule trees were leaked permanently at relcache flush. Also, clean up handling of rule creation and deletion --- there was not sufficient locking of the relation being modified, and there was no reliable notification of other backends that a relcache reload was needed. Also, clean up relcache.c code so that scans of system tables needed to load a relcache entry are done in the caller's memory context, not in CacheMemoryContext. This prevents any un-pfreed memory from those scans from becoming a permanent memory leak. --- src/include/utils/rel.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/include/utils') diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h index 901020611a..121012d7fd 100644 --- a/src/include/utils/rel.h +++ b/src/include/utils/rel.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: rel.h,v 1.38 2000/06/18 22:44:34 tgl Exp $ + * $Id: rel.h,v 1.39 2000/06/30 07:04:03 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -85,7 +85,7 @@ typedef struct TriggerDesc typedef struct RelationData { - File rd_fd; /* open file descriptor */ + File rd_fd; /* open file descriptor, or -1 if none */ int rd_nblocks; /* number of blocks in rel */ uint16 rd_refcnt; /* reference count */ bool rd_myxactonly; /* rel uses the local buffer mgr */ @@ -99,6 +99,7 @@ typedef struct RelationData LockInfoData rd_lockInfo; /* lock mgr's info for locking relation */ TupleDesc rd_att; /* tuple descriptor */ RuleLock *rd_rules; /* rewrite rules */ + MemoryContext rd_rulescxt; /* private memory cxt for rd_rules, if any */ IndexStrategy rd_istrat; /* info needed if rel is an index */ RegProcedure *rd_support; TriggerDesc *trigdesc; /* Trigger info, or NULL if rel has none */ -- cgit v1.2.1