forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit88ceac5
committed
Fix parallel-safety marking when moving initplans to another node.
Our policy since commitab77a5a has been that a plan node havingany initplans is automatically not parallel-safe. (This could berelaxed, but not today.) clean_up_removed_plan_level neglectedthis, and could attach initplans to a parallel-safe child plannode without clearing the plan's parallel-safe flag. That couldlead to "subplan was not initialized" errors at runtime, in casean initplan referenced another one and only the referencing onegot transmitted to parallel workers.The fix in clean_up_removed_plan_level is trivial enough.materialize_finished_plan also moves initplans from one nodeto another, but it's okay because it already copies the sourcenode's parallel_safe flag. The other place that does this kindof thing is standard_planner's hack to inject a top-level Gatherwhen debug_parallel_query is active. But that's actually deadcode given that we're correctly enforcing the "initplans aren'tparallel safe" rule, so just replace it with an Assert thatthere are no initplans.Also improve some related comments.Normally we'd add a regression test case for this sort of bug.The mistake itself is already reached by existing tests, but thereis accidentally no visible problem. The only known test case thatcreates an actual failure seems too indirect and fragile to justifykeeping it as a regression test (not least because it fails to failin v11, though the bug is clearly present there too).Per report from Justin Pryzby. Back-patch to all supported branches.Discussion:https://postgr.es/m/ZDVt6MaNWkRDO1LQ@telsasoft.com1 parent91199dd commit88ceac5
File tree
4 files changed
+22
-10
lines changed- src/backend/optimizer
- plan
- util
4 files changed
+22
-10
lines changedLines changed: 3 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
436 | 436 |
| |
437 | 437 |
| |
438 | 438 |
| |
439 |
| - | |
440 |
| - | |
441 |
| - | |
| 439 | + | |
| 440 | + | |
442 | 441 |
| |
443 |
| - | |
444 |
| - | |
| 442 | + | |
445 | 443 |
| |
446 | 444 |
| |
447 | 445 |
| |
|
Lines changed: 13 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1542 | 1542 |
| |
1543 | 1543 |
| |
1544 | 1544 |
| |
1545 |
| - | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
1546 | 1558 |
| |
1547 | 1559 |
| |
1548 | 1560 |
| |
|
Lines changed: 5 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2126 | 2126 |
| |
2127 | 2127 |
| |
2128 | 2128 |
| |
2129 |
| - | |
| 2129 | + | |
2130 | 2130 |
| |
2131 | 2131 |
| |
2132 | 2132 |
| |
| |||
2182 | 2182 |
| |
2183 | 2183 |
| |
2184 | 2184 |
| |
2185 |
| - | |
2186 |
| - | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
2187 | 2189 |
| |
2188 | 2190 |
| |
2189 | 2191 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3348 | 3348 |
| |
3349 | 3349 |
| |
3350 | 3350 |
| |
3351 |
| - | |
| 3351 | + | |
3352 | 3352 |
| |
3353 | 3353 |
| |
3354 | 3354 |
| |
|
0 commit comments
Comments
(0)