Improve division of labor between execParallel.c and nodeGather[Merge].c.
Tom Lane <tgl@sss.pgh.pa.us>
Improve division of labor between execParallel.c and nodeGather[Merge].c. Move the responsibility for creating/destroying TupleQueueReaders into execParallel.c, to avoid duplicative coding in nodeGather.c and nodeGatherMerge.c. Also, instead of having DestroyTupleQueueReader do shm_mq_detach, do it in the caller (which is now only ExecParallelFinish). This means execParallel.c does both the attaching and detaching of the tuple-queue-reader shm_mqs, which seems less weird than the previous arrangement. These changes also eliminate a vestigial memory leak (of the pei->tqueue array). It's now demonstrable that rescans of Gather or GatherMerge don't leak memory. Discussion: https://postgr.es/m/8670.1504192177@sss.pgh.pa.us
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/executor/execParallel.c | modified | +68 −4 |
| src/backend/executor/nodeGather.c | modified | +22 −42 |
| src/backend/executor/nodeGatherMerge.c | modified | +15 −35 |
| src/backend/executor/tqueue.c | modified | +3 −1 |
| src/include/executor/execParallel.h | modified | +11 −7 |
Discussion
- Assorted leaks and weirdness in parallel execution 4 messages · 2017-08-31