|
7 | 7 | * |
8 | 8 | * |
9 | 9 | * IDENTIFICATION |
10 | | - * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.71 1999/09/0618:13:02 tgl Exp $ |
| 10 | + * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.72 1999/09/0619:33:16 tgl Exp $ |
11 | 11 | * |
12 | 12 | *------------------------------------------------------------------------- |
13 | 13 | */ |
@@ -1264,9 +1264,12 @@ RelationFlushRelation(Relation *relationPtr, |
1264 | 1264 | */ |
1265 | 1265 | smgrclose(DEFAULT_SMGR,relation); |
1266 | 1266 |
|
1267 | | -if (relation->rd_isnailed) |
| 1267 | +if (relation->rd_isnailed||relation->rd_myxactonly) |
1268 | 1268 | { |
1269 | | -/* this is a nailed special relation for bootstrapping */ |
| 1269 | +/* Do not flush relation cache entry if it is a nailed-in system |
| 1270 | + * relation or it is marked transaction-local. |
| 1271 | + * (To delete a local relation, caller must clear rd_myxactonly!) |
| 1272 | + */ |
1270 | 1273 | return; |
1271 | 1274 | } |
1272 | 1275 |
|
@@ -1364,6 +1367,8 @@ RelationForgetRelation(Oid rid) |
1364 | 1367 | MemoryContextSwitchTo(oldcxt); |
1365 | 1368 | } |
1366 | 1369 |
|
| 1370 | +relation->rd_myxactonly= false;/* so it can be flushed */ |
| 1371 | + |
1367 | 1372 | RelationFlushRelation(&relation, false); |
1368 | 1373 | } |
1369 | 1374 | } |
@@ -1454,21 +1459,27 @@ RelationIdInvalidateRelationCacheByAccessMethodId(Oid accessMethodId) |
1454 | 1459 | * Will blow away either all the cached relation descriptors or |
1455 | 1460 | * those that have a zero reference count. |
1456 | 1461 | * |
| 1462 | + * This is currently used only to recover from SI message buffer overflow, |
| 1463 | + * so onlyFlushReferenceCountZero is always false. We do not blow away |
| 1464 | + * transaction-local relations, since they cannot be targets of SI updates. |
1457 | 1465 | */ |
1458 | 1466 | void |
1459 | 1467 | RelationCacheInvalidate(boolonlyFlushReferenceCountZero) |
1460 | 1468 | { |
1461 | 1469 | HashTableWalk(RelationNameCache, (HashtFunc)RelationFlushRelation, |
1462 | 1470 | onlyFlushReferenceCountZero); |
1463 | 1471 |
|
1464 | | -/* |
1465 | | - * nailed-in reldescs will still be in the cache... 6 hardwired heaps |
1466 | | - * + 3 hardwired indices == 9 total. |
1467 | | - */ |
1468 | 1472 | if (!onlyFlushReferenceCountZero) |
1469 | 1473 | { |
1470 | | -Assert(RelationNameCache->hctl->nkeys==9); |
1471 | | -Assert(RelationIdCache->hctl->nkeys==9); |
| 1474 | +/* |
| 1475 | + * Debugging check: what's left should be transaction-local relations |
| 1476 | + * plus nailed-in reldescs. There should be 6 hardwired heaps |
| 1477 | + * + 3 hardwired indices == 9 total. |
| 1478 | + */ |
| 1479 | +intnumRels=length(newlyCreatedRelns)+9; |
| 1480 | + |
| 1481 | +Assert(RelationNameCache->hctl->nkeys==numRels); |
| 1482 | +Assert(RelationIdCache->hctl->nkeys==numRels); |
1472 | 1483 | } |
1473 | 1484 | } |
1474 | 1485 |
|
@@ -1580,7 +1591,7 @@ RelationPurgeLocalRelation(bool xactCommitted) |
1580 | 1591 | smgrunlink(DEFAULT_SMGR,reln); |
1581 | 1592 | } |
1582 | 1593 |
|
1583 | | -reln->rd_myxactonly=FALSE; |
| 1594 | +reln->rd_myxactonly=false;/* so it can be flushed */ |
1584 | 1595 |
|
1585 | 1596 | if (!IsBootstrapProcessingMode()) |
1586 | 1597 | RelationFlushRelation(&reln, false); |
|