- Notifications
You must be signed in to change notification settings - Fork5
Commit16ebab6
committed
Avoid transferring parallel-unsafe subplans to parallel workers.
Commit5e6d8d2 allowed parallel workers to execute parallel-safesubplans, but it transmitted the query's entire list of subplans tothe worker(s). Since execMain.c blindly does ExecInitNode and laterExecEndNode on every list element, this resulted in parallel-unsafe plannodes nonetheless getting started up and shut down in parallel workers.That seems mostly harmless as far as core plan node types go (butmaybe not so much for Gather?). But it resulted in postgres_fdwopening and then closing extra remote connections, and it's likelythat other non-parallel-safe FDWs or custom scan providers would haveworse reactions.To fix, just make ExecSerializePlan replace parallel-unsafe subplanswith NULLs in the cut-down plan tree that it transmits to workers.This relies on ExecInitNode and ExecEndNode to do nothing on NULLinput, but they do anyway. If anything else is touching the droppedsubplans in a parallel worker, that would be a bug to be fixed.(This thus provides a strong guarantee that we won't try to dosomething with a parallel-unsafe subplan in a worker.)This is, I think, the last fix directly occasioned by Andreas Seltenreich'sbug report of a few days ago.Tom Lane and Amit KapilaDiscussion:https://postgr.es/m/87tw5x4vcu.fsf@credativ.de1 parentf6f9f8a commit16ebab6
2 files changed
+23
-5
lines changedLines changed: 21 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
123 | 123 |
| |
124 | 124 |
| |
125 | 125 |
| |
126 |
| - | |
| 126 | + | |
127 | 127 |
| |
128 | 128 |
| |
129 | 129 |
| |
| |||
137 | 137 |
| |
138 | 138 |
| |
139 | 139 |
| |
140 |
| - | |
| 140 | + | |
141 | 141 |
| |
142 |
| - | |
| 142 | + | |
143 | 143 |
| |
144 | 144 |
| |
145 | 145 |
| |
| |||
162 | 162 |
| |
163 | 163 |
| |
164 | 164 |
| |
165 |
| - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
166 | 183 |
| |
167 | 184 |
| |
168 | 185 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
68 | 68 |
| |
69 | 69 |
| |
70 | 70 |
| |
71 |
| - | |
| 71 | + | |
| 72 | + | |
72 | 73 |
| |
73 | 74 |
| |
74 | 75 |
| |
|
0 commit comments
Comments
(0)