Skip to content

Commit 3503f19

Browse files
committed
RelationClearRelation must reset rd_targblock and update rd_nblocks
even when dealing with a nailed-in-cache relation; otherwise, following VACUUM truncation of a system catalog, other backends might have unreasonably large values of these fields.
1 parent 286fb25 commit 3503f19

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/backend/utils/cache/relcache.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.175 2002/09/04 20:31:30 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.176 2002/09/22 20:56:28 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1685,10 +1685,14 @@ RelationClearRelation(Relation relation, bool rebuild)
16851685

16861686
/*
16871687
* Never, never ever blow away a nailed-in system relation, because
1688-
* we'd be unable to recover.
1688+
* we'd be unable to recover. However, we must update rd_nblocks
1689+
* and reset rd_targblock, in case we got called because of a relation
1690+
* cache flush that was triggered by VACUUM.
16891691
*/
16901692
if (relation->rd_isnailed)
16911693
{
1694+
relation->rd_targblock = InvalidBlockNumber;
1695+
RelationUpdateNumberOfBlocks(relation);
16921696
#ifdef ENABLE_REINDEX_NAILED_RELATIONS
16931697
RelationReloadClassinfo(relation);
16941698
#endif /* ENABLE_REINDEX_NAILED_RELATIONS */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy