forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit7df2c1f
committed
Force rescanning of parallel-aware scan nodes below a Gather[Merge].
The ExecReScan machinery contains various optimizations for postponingor skipping rescans of plan subtrees; for example a HashAgg node mayconclude that it can re-use the table it built before, instead ofre-reading its input subtree. But that is wrong if the input containsa parallel-aware table scan node, since the portion of the table scannedby the leader process is likely to vary from one rescan to the next.This explains the timing-dependent buildfarm failures we saw aftercommita2b70c8.The established mechanism for showing that a plan node's output ispotentially variable is to mark it as depending on some runtime Param.Hence, to fix this, invent a dummy Param (one that has a PARAM_EXECparameter number, but carries no actual value) associated with each Gatheror GatherMerge node, mark parallel-aware nodes below that node as dependenton that Param, and arrange for ExecReScanGather[Merge] to flag that Paramas changed whenever the Gather[Merge] node is rescanned.This solution breaks an undocumented assumption made by the parallelexecutor logic, namely that all rescans of nodes below a Gather[Merge]will happen synchronously during the ReScan of the top node itself.But that's fundamentally contrary to the design of the ExecReScan code,and so was doomed to fail someday anyway (even if you want to arguethat the bug being fixed here wasn't a failure of that assumption).A follow-on patch will address that issue. In the meantime, the worstthat's expected to happen is that given very bad timing luck, the leadermight have to do all the work during a rescan, because workers thinkthey have nothing to do, if they are able to start up before the eventualReScan of the leader's parallel-aware table scan node has reset theshared scan state.Although this problem exists in 9.6, there does not seem to be any wayfor it to manifest there. Without GatherMerge, it seems that a plan treethat has a rescan-short-circuiting node below Gather will always alsohave one above it that will short-circuit in the same cases, preventingthe Gather from being rescanned. Hence we won't take the risk ofback-patching this change into 9.6. But v10 needs it.Discussion:https://postgr.es/m/CAA4eK1JkByysFJNh9M349u_nNjqETuEnY_y1VUc_kJiU0bxtaQ@mail.gmail.com1 parent00f6d5c commit7df2c1f
File tree
11 files changed
+155
-24
lines changed- src
- backend
- executor
- nodes
- optimizer
- plan
- include/nodes
11 files changed
+155
-24
lines changedLines changed: 21 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
432 | 432 |
| |
433 | 433 |
| |
434 | 434 |
| |
| 435 | + | |
| 436 | + | |
| 437 | + | |
435 | 438 |
| |
436 | 439 |
| |
437 | 440 |
| |
| |||
445 | 448 |
| |
446 | 449 |
| |
447 | 450 |
| |
448 |
| - | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
449 | 469 |
|
Lines changed: 21 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
327 | 327 |
| |
328 | 328 |
| |
329 | 329 |
| |
| 330 | + | |
| 331 | + | |
| 332 | + | |
330 | 333 |
| |
331 | 334 |
| |
332 | 335 |
| |
| |||
341 | 344 |
| |
342 | 345 |
| |
343 | 346 |
| |
344 |
| - | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
345 | 365 |
| |
346 | 366 |
| |
347 | 367 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
361 | 361 |
| |
362 | 362 |
| |
363 | 363 |
| |
| 364 | + | |
364 | 365 |
| |
365 | 366 |
| |
366 | 367 |
| |
| |||
384 | 385 |
| |
385 | 386 |
| |
386 | 387 |
| |
| 388 | + | |
387 | 389 |
| |
388 | 390 |
| |
389 | 391 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
479 | 479 |
| |
480 | 480 |
| |
481 | 481 |
| |
| 482 | + | |
482 | 483 |
| |
483 | 484 |
| |
484 | 485 |
| |
| |||
493 | 494 |
| |
494 | 495 |
| |
495 | 496 |
| |
| 497 | + | |
496 | 498 |
| |
497 | 499 |
| |
498 | 500 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2163 | 2163 |
| |
2164 | 2164 |
| |
2165 | 2165 |
| |
| 2166 | + | |
2166 | 2167 |
| |
2167 | 2168 |
| |
2168 | 2169 |
| |
| |||
2180 | 2181 |
| |
2181 | 2182 |
| |
2182 | 2183 |
| |
| 2184 | + | |
2183 | 2185 |
| |
2184 | 2186 |
| |
2185 | 2187 |
| |
|
Lines changed: 10 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
374 | 374 |
| |
375 | 375 |
| |
376 | 376 |
| |
| 377 | + | |
377 | 378 |
| |
378 | 379 |
| |
379 | 380 |
| |
| |||
1030 | 1031 |
| |
1031 | 1032 |
| |
1032 | 1033 |
| |
1033 |
| - | |
| 1034 | + | |
1034 | 1035 |
| |
1035 | 1036 |
| |
1036 | 1037 |
| |
| |||
1046 | 1047 |
| |
1047 | 1048 |
| |
1048 | 1049 |
| |
1049 |
| - | |
1050 |
| - | |
1051 |
| - | |
1052 |
| - | |
1053 |
| - | |
1054 |
| - | |
1055 |
| - | |
1056 |
| - | |
1057 |
| - | |
1058 |
| - | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
1059 | 1058 |
| |
1060 | 1059 |
| |
1061 | 1060 |
| |
|
Lines changed: 7 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
267 | 267 |
| |
268 | 268 |
| |
269 | 269 |
| |
270 |
| - | |
| 270 | + | |
271 | 271 |
| |
272 | 272 |
| |
273 | 273 |
| |
| |||
1471 | 1471 |
| |
1472 | 1472 |
| |
1473 | 1473 |
| |
| 1474 | + | |
1474 | 1475 |
| |
1475 | 1476 |
| |
1476 | 1477 |
| |
| |||
1505 | 1506 |
| |
1506 | 1507 |
| |
1507 | 1508 |
| |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
1508 | 1512 |
| |
1509 | 1513 |
| |
1510 | 1514 |
| |
| |||
6238 | 6242 |
| |
6239 | 6243 |
| |
6240 | 6244 |
| |
| 6245 | + | |
6241 | 6246 |
| |
6242 | 6247 |
| |
6243 | 6248 |
| |
| |||
6249 | 6254 |
| |
6250 | 6255 |
| |
6251 | 6256 |
| |
| 6257 | + | |
6252 | 6258 |
| |
6253 | 6259 |
| |
6254 | 6260 |
| |
|
Lines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
374 | 374 |
| |
375 | 375 |
| |
376 | 376 |
| |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
377 | 383 |
| |
378 | 384 |
| |
379 | 385 |
| |
|
Lines changed: 69 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
79 | 79 |
| |
80 | 80 |
| |
81 | 81 |
| |
| 82 | + | |
82 | 83 |
| |
83 | 84 |
| |
84 | 85 |
| |
| |||
2217 | 2218 |
| |
2218 | 2219 |
| |
2219 | 2220 |
| |
2220 |
| - | |
| 2221 | + | |
2221 | 2222 |
| |
2222 | 2223 |
| |
2223 | 2224 |
| |
2224 | 2225 |
| |
2225 | 2226 |
| |
| 2227 | + | |
| 2228 | + | |
| 2229 | + | |
2226 | 2230 |
| |
2227 | 2231 |
| |
2228 | 2232 |
| |
| |||
2249 | 2253 |
| |
2250 | 2254 |
| |
2251 | 2255 |
| |
2252 |
| - | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
2253 | 2259 |
| |
2254 | 2260 |
| |
2255 | 2261 |
| |
| |||
2302 | 2308 |
| |
2303 | 2309 |
| |
2304 | 2310 |
| |
| 2311 | + | |
| 2312 | + | |
| 2313 | + | |
| 2314 | + | |
| 2315 | + | |
| 2316 | + | |
| 2317 | + | |
| 2318 | + | |
| 2319 | + | |
| 2320 | + | |
| 2321 | + | |
| 2322 | + | |
2305 | 2323 |
| |
2306 | 2324 |
| |
2307 | 2325 |
| |
| |||
2512 | 2530 |
| |
2513 | 2531 |
| |
2514 | 2532 |
| |
| 2533 | + | |
2515 | 2534 |
| |
2516 | 2535 |
| |
2517 | 2536 |
| |
| |||
2542 | 2561 |
| |
2543 | 2562 |
| |
2544 | 2563 |
| |
| 2564 | + | |
2545 | 2565 |
| |
2546 | 2566 |
| |
2547 | 2567 |
| |
| |||
2558 | 2578 |
| |
2559 | 2579 |
| |
2560 | 2580 |
| |
| 2581 | + | |
2561 | 2582 |
| |
2562 | 2583 |
| |
2563 | 2584 |
| |
| |||
2574 | 2595 |
| |
2575 | 2596 |
| |
2576 | 2597 |
| |
| 2598 | + | |
2577 | 2599 |
| |
2578 | 2600 |
| |
2579 | 2601 |
| |
| |||
2590 | 2612 |
| |
2591 | 2613 |
| |
2592 | 2614 |
| |
| 2615 | + | |
2593 | 2616 |
| |
2594 | 2617 |
| |
2595 | 2618 |
| |
| |||
2606 | 2629 |
| |
2607 | 2630 |
| |
2608 | 2631 |
| |
| 2632 | + | |
2609 | 2633 |
| |
2610 | 2634 |
| |
2611 | 2635 |
| |
| |||
2697 | 2721 |
| |
2698 | 2722 |
| |
2699 | 2723 |
| |
| 2724 | + | |
| 2725 | + | |
| 2726 | + | |
| 2727 | + | |
| 2728 | + | |
| 2729 | + | |
| 2730 | + | |
| 2731 | + | |
| 2732 | + | |
| 2733 | + | |
| 2734 | + | |
| 2735 | + | |
| 2736 | + | |
| 2737 | + | |
| 2738 | + | |
| 2739 | + | |
| 2740 | + | |
| 2741 | + | |
| 2742 | + | |
| 2743 | + | |
| 2744 | + | |
| 2745 | + | |
| 2746 | + | |
| 2747 | + | |
| 2748 | + | |
| 2749 | + | |
| 2750 | + | |
| 2751 | + | |
| 2752 | + | |
| 2753 | + | |
| 2754 | + | |
| 2755 | + | |
| 2756 | + | |
| 2757 | + | |
| 2758 | + | |
| 2759 | + | |
| 2760 | + | |
| 2761 | + | |
| 2762 | + | |
| 2763 | + | |
2700 | 2764 |
| |
2701 | 2765 |
| |
2702 | 2766 |
| |
2703 | 2767 |
| |
2704 | 2768 |
| |
2705 |
| - | |
2706 |
| - | |
2707 | 2769 |
| |
2708 | 2770 |
| |
2709 | 2771 |
| |
| |||
2717 | 2779 |
| |
2718 | 2780 |
| |
2719 | 2781 |
| |
| 2782 | + | |
2720 | 2783 |
| |
2721 | 2784 |
| |
2722 | 2785 |
| |
| |||
2726 | 2789 |
| |
2727 | 2790 |
| |
2728 | 2791 |
| |
| 2792 | + | |
2729 | 2793 |
| |
2730 | 2794 |
| |
2731 | 2795 |
| |
| |||
2737 | 2801 |
| |
2738 | 2802 |
| |
2739 | 2803 |
| |
| 2804 | + | |
2740 | 2805 |
| |
2741 | 2806 |
| |
2742 | 2807 |
| |
|
0 commit comments
Comments
(0)