88 *
99 *
1010 * IDENTIFICATION
11- * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.87 2000/01/26 05:57:17 momjian Exp $
11+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.88 2000/01/29 19:51:59 tgl Exp $
1212 *
1313 *-------------------------------------------------------------------------
1414 */
@@ -1406,14 +1406,26 @@ RelationIdInvalidateRelationCacheByRelationId(Oid relationId)
14061406 */
14071407if (PointerIsValid (relation )&& !relation -> rd_myxactonly )
14081408{
1409-
1409+ #if 1
1410+ /*
1411+ * Seems safest just to NEVER flush rels with positive refcounts.
1412+ * I think the code only had that proviso as a rather lame method of
1413+ * cleaning up unused relcache entries that had dangling refcounts
1414+ * (following elog(ERROR) with an open rel). Now we rely on
1415+ * RelationCacheAbort to clean up dangling refcounts, so there's no
1416+ * good reason to ever risk flushing a rel with positive refcount.
1417+ * IMHO anyway --- tgl 1/29/00.
1418+ */
1419+ RelationFlushRelation (& relation , true);
1420+ #else
14101421/*
14111422 * The boolean onlyFlushReferenceCountZero in RelationFlushReln()
14121423 * should be set to true when we are incrementing the command
14131424 * counter and to false when we are starting a new xaction. This
14141425 * can be determined by checking the current xaction status.
14151426 */
14161427RelationFlushRelation (& relation ,CurrentXactInProgress ());
1428+ #endif
14171429}
14181430}
14191431
@@ -1436,7 +1448,7 @@ RelationFlushIndexes(Relation *r,
14361448if (relation -> rd_rel -> relkind == RELKIND_INDEX && /* XXX style */
14371449(!OidIsValid (accessMethodId )||
14381450relation -> rd_rel -> relam == accessMethodId ))
1439- RelationFlushRelation (& relation ,false );
1451+ RelationFlushRelation (& relation ,true );
14401452}
14411453
14421454#endif
@@ -1469,9 +1481,14 @@ RelationIdInvalidateRelationCacheByAccessMethodId(Oid accessMethodId)
14691481 * Will blow away either all the cached relation descriptors or
14701482 * those that have a zero reference count.
14711483 *
1484+ * CAUTION: this is only called with onlyFlushReferenceCountZero=true
1485+ * at present, so that relation descriptors with positive refcounts
1486+ * are rebuilt rather than clobbered. It would only be safe to use a
1487+ * "false" parameter in a totally idle backend with no open relations.
1488+ *
14721489 * This is currently used only to recover from SI message buffer overflow,
1473- * soonlyFlushReferenceCountZero is always false. We do not blow away
1474- *transaction-local relations, since they cannot be targets of SI updates.
1490+ * sowe do not blow away transaction-local relations; they cannot be
1491+ * targets of SI updates.
14751492 */
14761493void
14771494RelationCacheInvalidate (bool onlyFlushReferenceCountZero )