Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcc8b67a

Browse files
committed
Fix relcache.c so that local relations (those created during
current transaction) are not flushed by shared-cache-inval reset message.SI reset actually works now, for probably the first time in a long time.I was able to run initdb and regression tests with a 16-element SI messagearray, with a lot of NOTICE: cache state reset messages but no crashes.
1 parentc509284 commitcc8b67a

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

‎src/backend/utils/cache/relcache.c

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* 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 $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1264,9 +1264,12 @@ RelationFlushRelation(Relation *relationPtr,
12641264
*/
12651265
smgrclose(DEFAULT_SMGR,relation);
12661266

1267-
if (relation->rd_isnailed)
1267+
if (relation->rd_isnailed||relation->rd_myxactonly)
12681268
{
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+
*/
12701273
return;
12711274
}
12721275

@@ -1364,6 +1367,8 @@ RelationForgetRelation(Oid rid)
13641367
MemoryContextSwitchTo(oldcxt);
13651368
}
13661369

1370+
relation->rd_myxactonly= false;/* so it can be flushed */
1371+
13671372
RelationFlushRelation(&relation, false);
13681373
}
13691374
}
@@ -1454,21 +1459,27 @@ RelationIdInvalidateRelationCacheByAccessMethodId(Oid accessMethodId)
14541459
* Will blow away either all the cached relation descriptors or
14551460
* those that have a zero reference count.
14561461
*
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.
14571465
*/
14581466
void
14591467
RelationCacheInvalidate(boolonlyFlushReferenceCountZero)
14601468
{
14611469
HashTableWalk(RelationNameCache, (HashtFunc)RelationFlushRelation,
14621470
onlyFlushReferenceCountZero);
14631471

1464-
/*
1465-
* nailed-in reldescs will still be in the cache... 6 hardwired heaps
1466-
* + 3 hardwired indices == 9 total.
1467-
*/
14681472
if (!onlyFlushReferenceCountZero)
14691473
{
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);
14721483
}
14731484
}
14741485

@@ -1580,7 +1591,7 @@ RelationPurgeLocalRelation(bool xactCommitted)
15801591
smgrunlink(DEFAULT_SMGR,reln);
15811592
}
15821593

1583-
reln->rd_myxactonly=FALSE;
1594+
reln->rd_myxactonly=false;/* so it can be flushed */
15841595

15851596
if (!IsBootstrapProcessingMode())
15861597
RelationFlushRelation(&reln, false);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp