* 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
| 163 | * but the caller is in a better position to report a meaningful error). |
| 164 | */ |
| 165 | Oid |
| 166 | RelationMapOidToFilenode(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 |
no outgoing calls
no test coverage detected