88 *
99 *
1010 * IDENTIFICATION
11- * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.123 2001/01/04 02:24:22 inoue Exp $
11+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.124 2001/01/06 01:48:59 inoue Exp $
1212 *
1313 *-------------------------------------------------------------------------
1414 */
@@ -2104,15 +2104,11 @@ RelationCacheInitialize(void)
21042104 formrdesc (LogRelationName , Natts_pg_log , Desc_pg_log );
21052105
21062106 /*
2107- * If this isn't initdb time, then we want to initialize some index
2108- * relation descriptors, as well. The descriptors are for
2109- * pg_attnumind (to make building relation descriptors fast) and
2110- * possibly others, as they're added.
2107+ * init_irels() used to be called here. It is changed to be called
2108+ * in RelationCacheInitializePhase2() now so that transactional
2109+ * control could guarantee the consistency.
21112110 */
21122111
2113- if (!IsBootstrapProcessingMode ())
2114- init_irels ();
2115-
21162112 MemoryContextSwitchTo (oldcxt );
21172113}
21182114
@@ -2134,6 +2130,17 @@ RelationCacheInitializePhase2(void)
21342130 */
21352131 if (!IsBootstrapProcessingMode ())
21362132 {
2133+ /*
2134+ * Initialize critical system index relation descriptors, first.
2135+ * They are to make building relation descriptors fast.
2136+ * init_irels() used to be called in RelationCacheInitialize().
2137+ * It is changed to be called here to be transaction safe.
2138+ */
2139+ MemoryContext oldcxt = MemoryContextSwitchTo (CacheMemoryContext );
2140+ init_irels ();
2141+ MemoryContextSwitchTo (oldcxt );
2142+
2143+ /* fix nailed-in-cache relations */
21372144 fixrdesc (RelationRelationName );
21382145 fixrdesc (AttributeRelationName );
21392146 fixrdesc (ProcedureRelationName );
0 commit comments