* 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. */
| 265 | * immediately. Otherwise it is made pending until CommandCounterIncrement. |
| 266 | */ |
| 267 | void |
| 268 | RelationMapUpdateMap(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 |
no test coverage detected