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

Function apply_map_update

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

* apply_map_update * * Insert a new mapping into the given map variable, replacing any existing * mapping for the same relation. * * In some cases the caller knows there must be an existing mapping; pass * add_okay = false to draw an error if not. */

Source from the content-addressed store, hash-verified

323 * add_okay = false to draw an error if not.
324 */
325static void
326apply_map_update(RelMapFile *map, Oid relationId, Oid fileNode, bool add_okay)
327{
328 int32 i;
329
330 /* Replace any existing mapping */
331 for (i = 0; i < map->num_mappings; i++)
332 {
333 if (relationId == map->mappings[i].mapoid)
334 {
335 map->mappings[i].mapfilenode = fileNode;
336 return;
337 }
338 }
339
340 /* Nope, need to add a new mapping */
341 if (!add_okay)
342 elog(ERROR, "attempt to apply a mapping to unmapped relation %u",
343 relationId);
344 if (map->num_mappings >= MAX_MAPPINGS)
345 elog(ERROR, "ran out of space in relation map");
346 map->mappings[map->num_mappings].mapoid = relationId;
347 map->mappings[map->num_mappings].mapfilenode = fileNode;
348 map->num_mappings++;
349}
350
351/*
352 * merge_map_updates

Callers 2

RelationMapUpdateMapFunction · 0.85
merge_map_updatesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected