---------------------------------------------------------------- * ExecReScanGather * * Prepare to re-scan the result of a Gather. * ---------------------------------------------------------------- */
| 440 | * ---------------------------------------------------------------- |
| 441 | */ |
| 442 | void |
| 443 | ExecReScanGather(GatherState *node) |
| 444 | { |
| 445 | Gather *gather = (Gather *) node->ps.plan; |
| 446 | PlanState *outerPlan = outerPlanState(node); |
| 447 | |
| 448 | /* Make sure any existing workers are gracefully shut down */ |
| 449 | ExecShutdownGatherWorkers(node); |
| 450 | |
| 451 | /* Mark node so that shared state will be rebuilt at next call */ |
| 452 | node->initialized = false; |
| 453 | |
| 454 | /* |
| 455 | * Set child node's chgParam to tell it that the next scan might deliver a |
| 456 | * different set of rows within the leader process. (The overall rowset |
| 457 | * shouldn't change, but the leader process's subset might; hence nodes |
| 458 | * between here and the parallel table scan node mustn't optimize on the |
| 459 | * assumption of an unchanging rowset.) |
| 460 | */ |
| 461 | if (gather->rescan_param >= 0) |
| 462 | outerPlan->chgParam = bms_add_member(outerPlan->chgParam, |
| 463 | gather->rescan_param); |
| 464 | |
| 465 | /* |
| 466 | * If chgParam of subnode is not null then plan will be re-scanned by |
| 467 | * first ExecProcNode. Note: because this does nothing if we have a |
| 468 | * rescan_param, it's currently guaranteed that parallel-aware child nodes |
| 469 | * will not see a ReScan call until after they get a ReInitializeDSM call. |
| 470 | * That ordering might not be something to rely on, though. A good rule |
| 471 | * of thumb is that ReInitializeDSM should reset only shared state, ReScan |
| 472 | * should reset only local state, and anything that depends on both of |
| 473 | * those steps being finished must wait until the first ExecProcNode call. |
| 474 | */ |
| 475 | if (outerPlan->chgParam == NULL) |
| 476 | ExecReScan(outerPlan); |
| 477 | } |
no test coverage detected