Skip to content

Commit 3acca18

Browse files
committed
Fix ancient memory leak in index_create(): RelationInitIndexAccessInfo
was being called twice in normal operation, leading to a leak of one set of relcache subsidiary info. Per report from Jeff Gold.
1 parent 252600f commit 3acca18

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/backend/catalog/index.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.257 2005/06/20 02:07:47 neilc Exp $
11+
* $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.258 2005/06/25 16:53:49 tgl Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -704,13 +704,21 @@ index_create(Oid heapRelationId,
704704
}
705705

706706
/*
707-
* Fill in the index strategy structure with information from the
708-
* catalogs. First we must advance the command counter so that we
709-
* will see the newly-entered index catalog tuples.
707+
* Advance the command counter so that we can see the newly-entered
708+
* catalog tuples for the index.
710709
*/
711710
CommandCounterIncrement();
712711

713-
RelationInitIndexAccessInfo(indexRelation);
712+
/*
713+
* In bootstrap mode, we have to fill in the index strategy structure
714+
* with information from the catalogs. If we aren't bootstrapping,
715+
* then the relcache entry has already been rebuilt thanks to sinval
716+
* update during CommandCounterIncrement.
717+
*/
718+
if (IsBootstrapProcessingMode())
719+
RelationInitIndexAccessInfo(indexRelation);
720+
else
721+
Assert(indexRelation->rd_indexcxt != NULL);
714722

715723
/*
716724
* If this is bootstrap (initdb) time, then we don't actually fill in

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