aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/cache/relcache.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-01-08 18:34:44 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-01-08 18:34:44 +0000
commitb95f81a54a0c7fd87052d77f5401192a2bb87d6d (patch)
tree87bf9181a688769e606f3dfa24dfd42417def50c /src/backend/utils/cache/relcache.c
parente2586c3c62cdad8b495c44891160279982147926 (diff)
downloadpostgresql-b95f81a54a0c7fd87052d77f5401192a2bb87d6d.tar.gz
postgresql-b95f81a54a0c7fd87052d77f5401192a2bb87d6d.zip
Add some debugging support code (ifdef'd out in normal use).
Diffstat (limited to 'src/backend/utils/cache/relcache.c')
-rw-r--r--src/backend/utils/cache/relcache.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index f3ca1903db9..a14c10f76e8 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.125 2001/01/06 21:53:18 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.126 2001/01/08 18:34:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1557,7 +1557,13 @@ RelationNameGetRelation(const char *relationName)
/* --------------------------------
* RelationClose - close an open relation
*
- * Actually, we just decrement the refcount.
+ * Actually, we just decrement the refcount.
+ *
+ * NOTE: if compiled with -DRELCACHE_FORCE_RELEASE then relcache entries
+ * will be freed as soon as their refcount goes to zero. In combination
+ * with aset.c's CLOBBER_FREED_MEMORY option, this provides a good test
+ * to catch references to already-released relcache entries. It slows
+ * things down quite a bit, however.
* --------------------------------
*/
void
@@ -1565,6 +1571,11 @@ RelationClose(Relation relation)
{
/* Note: no locking manipulations needed */
RelationDecrementReferenceCount(relation);
+
+#ifdef RELCACHE_FORCE_RELEASE
+ if (RelationHasReferenceCountZero(relation) && !relation->rd_myxactonly)
+ RelationClearRelation(relation, false);
+#endif
}
#ifdef ENABLE_REINDEX_NAILED_RELATIONS
@@ -1603,6 +1614,7 @@ RelationReloadClassinfo(Relation relation)
return;
}
#endif /* ENABLE_REINDEX_NAILED_RELATIONS */
+
/* --------------------------------
* RelationClearRelation
*
@@ -1611,9 +1623,6 @@ RelationReloadClassinfo(Relation relation)
* usually used when we are notified of a change to an open relation
* (one with refcount > 0). However, this routine just does whichever
* it's told to do; callers must determine which they want.
- *
- * If we detect a change in the relation's TupleDesc, rules, or triggers
- * while rebuilding, we complain unless refcount is 0.
* --------------------------------
*/
static void