* RelationCacheInitializePhase2 * * This is called to prepare for access to shared catalogs during startup. * We must at least set up nailed reldescs for pg_database, pg_authid, * pg_auth_members, and pg_shseclabel. Ideally we'd like to have reldescs * for their indexes, too. We attempt to load this information from the * shared relcache init file. If that's missing or broken, just m
| 4128 | * RelationCacheInitializePhase3 will clean up as needed. |
| 4129 | */ |
| 4130 | void |
| 4131 | RelationCacheInitializePhase2(void) |
| 4132 | { |
| 4133 | MemoryContext oldcxt; |
| 4134 | |
| 4135 | /* |
| 4136 | * relation mapper needs initialized too |
| 4137 | */ |
| 4138 | RelationMapInitializePhase2(); |
| 4139 | |
| 4140 | /* |
| 4141 | * In bootstrap mode, the shared catalogs aren't there yet anyway, so do |
| 4142 | * nothing. |
| 4143 | */ |
| 4144 | if (IsBootstrapProcessingMode()) |
| 4145 | return; |
| 4146 | |
| 4147 | /* |
| 4148 | * switch to cache memory context |
| 4149 | */ |
| 4150 | oldcxt = MemoryContextSwitchTo(CacheMemoryContext); |
| 4151 | |
| 4152 | /* |
| 4153 | * Try to load the shared relcache cache file. If unsuccessful, bootstrap |
| 4154 | * the cache with pre-made descriptors for the critical shared catalogs. |
| 4155 | */ |
| 4156 | if (!load_relcache_init_file(true)) |
| 4157 | { |
| 4158 | formrdesc("pg_database", DatabaseRelation_Rowtype_Id, true, |
| 4159 | Natts_pg_database, Desc_pg_database); |
| 4160 | formrdesc("pg_authid", AuthIdRelation_Rowtype_Id, true, |
| 4161 | Natts_pg_authid, Desc_pg_authid); |
| 4162 | formrdesc("pg_password_history", PasswordHistoryRelation_Rowtype_Id, true, |
| 4163 | Natts_pg_password_history, Desc_pg_password_history); |
| 4164 | formrdesc("pg_profile", ProfileRelation_Rowtype_Id, true, |
| 4165 | Natts_pg_profile, Desc_pg_profile); |
| 4166 | formrdesc("pg_auth_members", AuthMemRelation_Rowtype_Id, true, |
| 4167 | Natts_pg_auth_members, Desc_pg_auth_members); |
| 4168 | formrdesc("pg_shseclabel", SharedSecLabelRelation_Rowtype_Id, true, |
| 4169 | Natts_pg_shseclabel, Desc_pg_shseclabel); |
| 4170 | formrdesc("pg_subscription", SubscriptionRelation_Rowtype_Id, true, |
| 4171 | Natts_pg_subscription, Desc_pg_subscription); |
| 4172 | formrdesc("pg_auth_time_constraint", AuthTimeConstraint_Rowtype_Id, true, |
| 4173 | Natts_pg_auth_time_constraint, Desc_pg_auth_time_constraint_members); |
| 4174 | |
| 4175 | #define NUM_CRITICAL_SHARED_RELS 8 /* fix if you change list above */ |
| 4176 | } |
| 4177 | |
| 4178 | MemoryContextSwitchTo(oldcxt); |
| 4179 | } |
| 4180 | |
| 4181 | /* |
| 4182 | * RelationCacheInitializePhase3 |
no test coverage detected