8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.125 2001/01/06 21:53:18 tgl Exp $
11
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.126 2001/01/08 18:34:44 tgl Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -1557,14 +1557,25 @@ RelationNameGetRelation(const char *relationName)
1557
1557
/* --------------------------------
1558
1558
* RelationClose - close an open relation
1559
1559
*
1560
- * Actually, we just decrement the refcount.
1560
+ * Actually, we just decrement the refcount.
1561
+ *
1562
+ * NOTE: if compiled with -DRELCACHE_FORCE_RELEASE then relcache entries
1563
+ * will be freed as soon as their refcount goes to zero. In combination
1564
+ * with aset.c's CLOBBER_FREED_MEMORY option, this provides a good test
1565
+ * to catch references to already-released relcache entries. It slows
1566
+ * things down quite a bit, however.
1561
1567
* --------------------------------
1562
1568
*/
1563
1569
void
1564
1570
RelationClose (Relation relation )
1565
1571
{
1566
1572
/* Note: no locking manipulations needed */
1567
1573
RelationDecrementReferenceCount (relation );
1574
+
1575
+ #ifdef RELCACHE_FORCE_RELEASE
1576
+ if (RelationHasReferenceCountZero (relation ) && !relation -> rd_myxactonly )
1577
+ RelationClearRelation (relation , false);
1578
+ #endif
1568
1579
}
1569
1580
1570
1581
#ifdef ENABLE_REINDEX_NAILED_RELATIONS
@@ -1603,6 +1614,7 @@ RelationReloadClassinfo(Relation relation)
1603
1614
return ;
1604
1615
}
1605
1616
#endif /* ENABLE_REINDEX_NAILED_RELATIONS */
1617
+
1606
1618
/* --------------------------------
1607
1619
* RelationClearRelation
1608
1620
*
@@ -1611,9 +1623,6 @@ RelationReloadClassinfo(Relation relation)
1611
1623
* usually used when we are notified of a change to an open relation
1612
1624
* (one with refcount > 0). However, this routine just does whichever
1613
1625
* it's told to do; callers must determine which they want.
1614
- *
1615
- * If we detect a change in the relation's TupleDesc, rules, or triggers
1616
- * while rebuilding, we complain unless refcount is 0.
1617
1626
* --------------------------------
1618
1627
*/
1619
1628
static void
0 commit comments