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

Function RelationMapOidToFilenode

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

* RelationMapOidToFilenode * * The raison d' etre ... given a relation OID, look up its filenode. * * Although shared and local relation OIDs should never overlap, the caller * always knows which we need --- so pass that information to avoid useless * searching. * * Returns InvalidOid if the OID is not known (which should never happen, * but the caller is in a better position to report a

Source from the content-addressed store, hash-verified

163 * but the caller is in a better position to report a meaningful error).
164 */
165Oid
166RelationMapOidToFilenode(Oid relationId, bool shared)
167{
168 const RelMapFile *map;
169 int32 i;
170
171 /* If there are active updates, believe those over the main maps */
172 if (shared)
173 {
174 map = &active_shared_updates;
175 for (i = 0; i < map->num_mappings; i++)
176 {
177 if (relationId == map->mappings[i].mapoid)
178 return map->mappings[i].mapfilenode;
179 }
180 map = &shared_map;
181 for (i = 0; i < map->num_mappings; i++)
182 {
183 if (relationId == map->mappings[i].mapoid)
184 return map->mappings[i].mapfilenode;
185 }
186 }
187 else
188 {
189 map = &active_local_updates;
190 for (i = 0; i < map->num_mappings; i++)
191 {
192 if (relationId == map->mappings[i].mapoid)
193 return map->mappings[i].mapfilenode;
194 }
195 map = &local_map;
196 for (i = 0; i < map->num_mappings; i++)
197 {
198 if (relationId == map->mappings[i].mapoid)
199 return map->mappings[i].mapfilenode;
200 }
201 }
202
203 return InvalidOid;
204}
205
206/*
207 * RelationMapFilenodeToOid

Callers 5

RelationInitPhysicalAddrFunction · 0.85
pg_relation_filenodeFunction · 0.85
pg_relation_filepathFunction · 0.85
swap_relation_filesFunction · 0.85
get_relfilenode_mapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected