forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitb5ee4e5
committed
Avoid nbtree parallel scan currPos confusion.
Commit1bd4bc8, which refactored nbtree sibling link traversal, made_bt_parallel_seize reset the scan's currPos so that things wereconsistent with the state of a serial backend moving between pages.This overlooked the fact that _bt_readnextpage relied on the existingcurrPos state to decide when to end the scan -- even though it came frombefore the scan was seized. As a result of all this, parallel nbtreescans could needlessly behave like full index scans.To fix, teach _bt_readnextpage to explicitly allow the use of an alreadyread page's so->currPos when deciding whether to end the scan -- evenduring parallel index scans (allow it consistently now). This requiresmoving _bt_readnextpage's seizure of the scan to earlier in its loop.That way _bt_readnextpage either deals with the true so->currPos state,or an initialized-by-_bt_parallel_seize currPos state set from when thescan was seized. Now _bt_steppage (the most important _bt_readnextpagecaller) takes the same uniform approach to setting up its call usingdetails taken from so->currPos -- regardless of whether the scan happensto be parallel or serial.The new loop structure in _bt_readnextpage is prone to getting confusedby P_NONE blknos set when the rightmost or leftmost page was reached.We could avoid that by adding an explicit check, but that would be ugly.Avoid this problem by teaching _bt_parallel_seize to end the parallelscan instead of returning a P_NONE next block/blkno. Doing things thisway was arguably a missed opportunity for commit1bd4bc8. It allows usto remove a similar "blkno == P_NONE" check from _bt_first.Oversight in commit1bd4bc8, which refactored sibling link traversal(as part of optimizing nbtree backward scan locking).Author: Peter Geoghegan <pg@bowt.ie>Reported-By: Masahiro Ikeda <ikedamsh@oss.nttdata.com>Diagnosed-By: Masahiro Ikeda <ikedamsh@oss.nttdata.com>Reviewed-By: Masahiro Ikeda <ikedamsh@oss.nttdata.com>Discussion:https://postgr.es/m/f8efb9c0f8d1a71b44fd7f8e42e49c25@oss.nttdata.com1 parent14e87ff commitb5ee4e5
3 files changed
+79
-76
lines changedLines changed: 24 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
596 | 596 |
| |
597 | 597 |
| |
598 | 598 |
| |
599 |
| - | |
600 |
| - | |
601 |
| - | |
| 599 | + | |
602 | 600 |
| |
603 | 601 |
| |
604 | 602 |
| |
| |||
608 | 606 |
| |
609 | 607 |
| |
610 | 608 |
| |
611 |
| - | |
612 |
| - | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
613 | 612 |
| |
614 | 613 |
| |
615 | 614 |
| |
616 |
| - | |
| 615 | + | |
617 | 616 |
| |
618 | 617 |
| |
619 | 618 |
| |
| |||
657 | 656 |
| |
658 | 657 |
| |
659 | 658 |
| |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
660 | 666 |
| |
661 | 667 |
| |
662 | 668 |
| |
| |||
673 | 679 |
| |
674 | 680 |
| |
675 | 681 |
| |
676 |
| - | |
677 | 682 |
| |
678 | 683 |
| |
679 | 684 |
| |
| |||
701 | 706 |
| |
702 | 707 |
| |
703 | 708 |
| |
| 709 | + | |
704 | 710 |
| |
705 | 711 |
| |
706 | 712 |
| |
| |||
712 | 718 |
| |
713 | 719 |
| |
714 | 720 |
| |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
715 | 725 |
| |
716 | 726 |
| |
717 | 727 |
| |
| |||
724 | 734 |
| |
725 | 735 |
| |
726 | 736 |
| |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
727 | 741 |
| |
728 | 742 |
| |
729 | 743 |
| |
| |||
736 | 750 |
| |
737 | 751 |
| |
738 | 752 |
| |
| 753 | + | |
| 754 | + | |
739 | 755 |
| |
740 | 756 |
| |
741 | 757 |
| |
| |||
770 | 786 |
| |
771 | 787 |
| |
772 | 788 |
| |
773 |
| - | |
| 789 | + | |
774 | 790 |
| |
775 | 791 |
| |
776 | 792 |
| |
|
Lines changed: 53 additions & 68 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
46 | 46 |
| |
47 | 47 |
| |
48 | 48 |
| |
49 |
| - | |
| 49 | + | |
| 50 | + | |
50 | 51 |
| |
51 | 52 |
| |
52 | 53 |
| |
| |||
888 | 889 |
| |
889 | 890 |
| |
890 | 891 |
| |
891 |
| - | |
892 | 892 |
| |
893 | 893 |
| |
894 | 894 |
| |
| |||
924 | 924 |
| |
925 | 925 |
| |
926 | 926 |
| |
927 |
| - | |
928 | 927 |
| |
929 |
| - | |
| 928 | + | |
| 929 | + | |
930 | 930 |
| |
931 | 931 |
| |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
932 | 936 |
| |
933 |
| - | |
| 937 | + | |
934 | 938 |
| |
935 | 939 |
| |
936 | 940 |
| |
937 | 941 |
| |
938 |
| - | |
939 |
| - | |
940 |
| - | |
941 |
| - | |
942 |
| - | |
943 |
| - | |
944 |
| - | |
945 |
| - | |
| 942 | + | |
| 943 | + | |
946 | 944 |
| |
947 | 945 |
| |
948 | 946 |
| |
949 | 947 |
| |
950 | 948 |
| |
951 | 949 |
| |
952 | 950 |
| |
953 |
| - | |
| 951 | + | |
954 | 952 |
| |
955 | 953 |
| |
956 | 954 |
| |
| |||
1043 | 1041 |
| |
1044 | 1042 |
| |
1045 | 1043 |
| |
| 1044 | + | |
1046 | 1045 |
| |
1047 | 1046 |
| |
1048 | 1047 |
| |
| |||
1053 | 1052 |
| |
1054 | 1053 |
| |
1055 | 1054 |
| |
1056 |
| - | |
| 1055 | + | |
1057 | 1056 |
| |
1058 | 1057 |
| |
1059 | 1058 |
| |
| |||
1168 | 1167 |
| |
1169 | 1168 |
| |
1170 | 1169 |
| |
1171 |
| - | |
| 1170 | + | |
1172 | 1171 |
| |
1173 | 1172 |
| |
1174 | 1173 |
| |
| |||
2006 | 2005 |
| |
2007 | 2006 |
| |
2008 | 2007 |
| |
| 2008 | + | |
| 2009 | + | |
2009 | 2010 |
| |
2010 | 2011 |
| |
2011 | 2012 |
| |
2012 | 2013 |
| |
2013 |
| - | |
2014 |
| - | |
2015 |
| - | |
2016 |
| - | |
2017 |
| - | |
2018 |
| - | |
2019 |
| - | |
2020 |
| - | |
2021 | 2014 |
| |
2022 | 2015 |
| |
2023 | 2016 |
| |
| |||
2081 | 2074 |
| |
2082 | 2075 |
| |
2083 | 2076 |
| |
2084 |
| - | |
2085 |
| - | |
2086 |
| - | |
2087 |
| - | |
2088 |
| - | |
2089 |
| - | |
2090 |
| - | |
2091 |
| - | |
2092 |
| - | |
2093 |
| - | |
2094 |
| - | |
2095 |
| - | |
2096 |
| - | |
2097 |
| - | |
2098 |
| - | |
2099 |
| - | |
2100 |
| - | |
2101 |
| - | |
| 2077 | + | |
| 2078 | + | |
2102 | 2079 |
| |
2103 |
| - | |
2104 |
| - | |
2105 |
| - | |
2106 |
| - | |
2107 |
| - | |
2108 |
| - | |
2109 |
| - | |
| 2080 | + | |
| 2081 | + | |
2110 | 2082 |
| |
2111 |
| - | |
2112 |
| - | |
| 2083 | + | |
| 2084 | + | |
| 2085 | + | |
| 2086 | + | |
| 2087 | + | |
| 2088 | + | |
| 2089 | + | |
| 2090 | + | |
2113 | 2091 |
| |
2114 |
| - | |
| 2092 | + | |
2115 | 2093 |
| |
2116 | 2094 |
| |
2117 | 2095 |
| |
| |||
2203 | 2181 |
| |
2204 | 2182 |
| |
2205 | 2183 |
| |
2206 |
| - | |
2207 |
| - | |
| 2184 | + | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
2208 | 2192 |
| |
2209 | 2193 |
| |
2210 |
| - | |
2211 |
| - | |
2212 |
| - | |
2213 |
| - | |
| 2194 | + | |
| 2195 | + | |
| 2196 | + | |
2214 | 2197 |
| |
2215 | 2198 |
| |
2216 | 2199 |
| |
| |||
2220 | 2203 |
| |
2221 | 2204 |
| |
2222 | 2205 |
| |
2223 |
| - | |
| 2206 | + | |
2224 | 2207 |
| |
2225 | 2208 |
| |
2226 | 2209 |
| |
2227 | 2210 |
| |
2228 |
| - | |
| 2211 | + | |
2229 | 2212 |
| |
2230 | 2213 |
| |
2231 | 2214 |
| |
| |||
2254 | 2237 |
| |
2255 | 2238 |
| |
2256 | 2239 |
| |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
2257 | 2249 |
| |
2258 | 2250 |
| |
2259 | 2251 |
| |
| |||
2308 | 2300 |
| |
2309 | 2301 |
| |
2310 | 2302 |
| |
2311 |
| - | |
2312 |
| - | |
2313 |
| - | |
2314 |
| - | |
2315 |
| - | |
2316 |
| - | |
2317 |
| - | |
2318 |
| - | |
| 2303 | + | |
2319 | 2304 |
| |
2320 | 2305 |
| |
2321 | 2306 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2402 | 2402 |
| |
2403 | 2403 |
| |
2404 | 2404 |
| |
| 2405 | + | |
| 2406 | + | |
2405 | 2407 |
| |
2406 | 2408 |
| |
2407 | 2409 |
| |
|
0 commit comments
Comments
(0)