8
8
*
9
9
*
10
10
* 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 $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -1406,14 +1406,26 @@ RelationIdInvalidateRelationCacheByRelationId(Oid relationId)
1406
1406
*/
1407
1407
if (PointerIsValid (relation ) && !relation -> rd_myxactonly )
1408
1408
{
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
1410
1421
/*
1411
1422
* The boolean onlyFlushReferenceCountZero in RelationFlushReln()
1412
1423
* should be set to true when we are incrementing the command
1413
1424
* counter and to false when we are starting a new xaction. This
1414
1425
* can be determined by checking the current xaction status.
1415
1426
*/
1416
1427
RelationFlushRelation (& relation , CurrentXactInProgress ());
1428
+ #endif
1417
1429
}
1418
1430
}
1419
1431
@@ -1436,7 +1448,7 @@ RelationFlushIndexes(Relation *r,
1436
1448
if (relation -> rd_rel -> relkind == RELKIND_INDEX && /* XXX style */
1437
1449
(!OidIsValid (accessMethodId ) ||
1438
1450
relation -> rd_rel -> relam == accessMethodId ))
1439
- RelationFlushRelation (& relation , false );
1451
+ RelationFlushRelation (& relation , true );
1440
1452
}
1441
1453
1442
1454
#endif
@@ -1469,9 +1481,14 @@ RelationIdInvalidateRelationCacheByAccessMethodId(Oid accessMethodId)
1469
1481
* Will blow away either all the cached relation descriptors or
1470
1482
* those that have a zero reference count.
1471
1483
*
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
+ *
1472
1489
* This is currently used only to recover from SI message buffer overflow,
1473
- * so onlyFlushReferenceCountZero is always false. We do not blow away
1474
- * transaction-local relations, since they cannot be targets of SI updates.
1490
+ * so we do not blow away transaction-local relations; they cannot be
1491
+ * targets of SI updates.
1475
1492
*/
1476
1493
void
1477
1494
RelationCacheInvalidate (bool onlyFlushReferenceCountZero )
0 commit comments