---------------------------------------------------------------- * ExecHashJoinReInitializeDSM * * Reset shared state before beginning a fresh scan. * ---------------------------------------------------------------- */
| 2119 | * ---------------------------------------------------------------- |
| 2120 | */ |
| 2121 | void |
| 2122 | ExecHashJoinReInitializeDSM(HashJoinState *state, ParallelContext *cxt) |
| 2123 | { |
| 2124 | int plan_node_id = state->js.ps.plan->plan_node_id; |
| 2125 | ParallelHashJoinState *pstate = |
| 2126 | shm_toc_lookup(cxt->toc, plan_node_id, false); |
| 2127 | |
| 2128 | /* |
| 2129 | * It would be possible to reuse the shared hash table in single-batch |
| 2130 | * cases by resetting and then fast-forwarding build_barrier to |
| 2131 | * PHJ_BUILD_DONE and batch 0's batch_barrier to PHJ_BATCH_PROBING, but |
| 2132 | * currently shared hash tables are already freed by now (by the last |
| 2133 | * participant to detach from the batch). We could consider keeping it |
| 2134 | * around for single-batch joins. We'd also need to adjust |
| 2135 | * finalize_plan() so that it doesn't record a dummy dependency for |
| 2136 | * Parallel Hash nodes, preventing the rescan optimization. For now we |
| 2137 | * don't try. |
| 2138 | */ |
| 2139 | |
| 2140 | /* Detach, freeing any remaining shared memory. */ |
| 2141 | if (state->hj_HashTable != NULL) |
| 2142 | { |
| 2143 | ExecHashTableDetachBatch(state->hj_HashTable); |
| 2144 | ExecHashTableDetach(state->hj_HashTable); |
| 2145 | } |
| 2146 | |
| 2147 | /* Clear any shared batch files. */ |
| 2148 | SharedFileSetDeleteAll(&pstate->fileset); |
| 2149 | |
| 2150 | /* Reset build_barrier to PHJ_BUILD_ELECTING so we can go around again. */ |
| 2151 | BarrierInit(&pstate->build_barrier, 0); |
| 2152 | } |
| 2153 | |
| 2154 | void |
| 2155 | ExecHashJoinInitializeWorker(HashJoinState *state, |
no test coverage detected