* Copy instrumentation information from this node and its descendants into * dynamic shared memory, so that the parallel leader can retrieve it. */
| 1262 | * dynamic shared memory, so that the parallel leader can retrieve it. |
| 1263 | */ |
| 1264 | static bool |
| 1265 | ExecParallelReportInstrumentation(PlanState *planstate, |
| 1266 | SharedExecutorInstrumentation *instrumentation) |
| 1267 | { |
| 1268 | int i; |
| 1269 | int plan_node_id = planstate->plan->plan_node_id; |
| 1270 | Instrumentation *instrument; |
| 1271 | |
| 1272 | InstrEndLoop(planstate->instrument); |
| 1273 | |
| 1274 | /* |
| 1275 | * If we shuffled the plan_node_id values in ps_instrument into sorted |
| 1276 | * order, we could use binary search here. This might matter someday if |
| 1277 | * we're pushing down sufficiently large plan trees. For now, do it the |
| 1278 | * slow, dumb way. |
| 1279 | */ |
| 1280 | for (i = 0; i < instrumentation->num_plan_nodes; ++i) |
| 1281 | if (instrumentation->plan_node_id[i] == plan_node_id) |
| 1282 | break; |
| 1283 | if (i >= instrumentation->num_plan_nodes) |
| 1284 | elog(ERROR, "plan node %d not found", plan_node_id); |
| 1285 | |
| 1286 | /* |
| 1287 | * Add our statistics to the per-node, per-worker totals. It's possible |
| 1288 | * that this could happen more than once if we relaunched workers. |
| 1289 | */ |
| 1290 | instrument = GetInstrumentationArray(instrumentation); |
| 1291 | instrument += i * instrumentation->num_workers; |
| 1292 | Assert(IsParallelWorker()); |
| 1293 | Assert(ParallelWorkerNumber < instrumentation->num_workers); |
| 1294 | InstrAggNode(&instrument[ParallelWorkerNumber], planstate->instrument); |
| 1295 | |
| 1296 | return planstate_tree_walker(planstate, ExecParallelReportInstrumentation, |
| 1297 | instrumentation); |
| 1298 | } |
| 1299 | |
| 1300 | /* |
| 1301 | * Initialize the PlanState and its descendants with the information |
no test coverage detected