MCPcopy Create free account
hub / github.com/apache/cloudberry / RelationMapUpdateMap

Function RelationMapUpdateMap

src/backend/utils/cache/relmapper.c:267–314  ·  view source on GitHub ↗

* RelationMapUpdateMap * * Install a new relfilenode mapping for the specified relation. * * If immediate is true (or we're bootstrapping), the mapping is activated * immediately. Otherwise it is made pending until CommandCounterIncrement. */

Source from the content-addressed store, hash-verified

265 * immediately. Otherwise it is made pending until CommandCounterIncrement.
266 */
267void
268RelationMapUpdateMap(Oid relationId, Oid fileNode, bool shared,
269 bool immediate)
270{
271 RelMapFile *map;
272
273 if (IsBootstrapProcessingMode())
274 {
275 /*
276 * In bootstrap mode, the mapping gets installed in permanent map.
277 */
278 if (shared)
279 map = &shared_map;
280 else
281 map = &local_map;
282 }
283 else
284 {
285 /*
286 * We don't currently support map changes within subtransactions, or
287 * when in parallel mode. This could be done with more bookkeeping
288 * infrastructure, but it doesn't presently seem worth it.
289 */
290 if (GetCurrentTransactionNestLevel() > 1)
291 elog(ERROR, "cannot change relation mapping within subtransaction");
292
293 if (IsInParallelMode())
294 elog(ERROR, "cannot change relation mapping in parallel mode");
295
296 if (immediate)
297 {
298 /* Make it active, but only locally */
299 if (shared)
300 map = &active_shared_updates;
301 else
302 map = &active_local_updates;
303 }
304 else
305 {
306 /* Make it pending */
307 if (shared)
308 map = &pending_shared_updates;
309 else
310 map = &pending_local_updates;
311 }
312 }
313 apply_map_update(map, relationId, fileNode, true);
314}
315
316/*
317 * apply_map_update

Callers 4

formrdescFunction · 0.85
swap_relation_filesFunction · 0.85

Calls 3

IsInParallelModeFunction · 0.85
apply_map_updateFunction · 0.85

Tested by

no test coverage detected