- Notifications
You must be signed in to change notification settings - Fork5.2k
Commit5f4d98d
committed
Prevent premature nbtree array advancement.
nbtree array index scans could fail to return matching tuples in rarecases where the missed tuples cover key space that the scan's arraysincorrectly indicate has already been read. These cases involved nearbytuples with NULL values that were evaluated using a skip array key whilein pstate.forcenonrequired mode.To fix, prevent forcenonrequired mode from prematurely advancing thescan's array keys beyond key space that the scan has yet to read tuplesfrom: reset the scan's array keys (to the first elements in the currentscan direction) before the _bt_checkkeys call for pstate.finaltup. Thatway _bt_checkkeys starts from a clean slate, which ensures that it willcall _bt_advance_array_keys (while passing it sktrig_required=true).This reliably restores the invariant that the scan's arrays alwaysaccurately track its progress through the index's key space (at leastwhen the scan is "between pages").Oversight in commit8a51027, which optimized nbtree search scan keycomparisons.Author: Peter Geoghegan <pg@bowt.ie>Reviewed-By: Mark Dilger <mark.dilger@enterprisedb.com>Discussion:https://postgr.es/m/CAH2-WzmodSE+gpTd1CRGU9ez8ytyyDS+Kns2r9NzgUp1s56kpw@mail.gmail.com1 parent7e25c93 commit5f4d98d
2 files changed
+39
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1790 | 1790 | | |
1791 | 1791 | | |
1792 | 1792 | | |
1793 | | - | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
1794 | 1796 | | |
1795 | 1797 | | |
| 1798 | + | |
| 1799 | + | |
1796 | 1800 | | |
1797 | 1801 | | |
1798 | 1802 | | |
| |||
1879 | 1883 | | |
1880 | 1884 | | |
1881 | 1885 | | |
| 1886 | + | |
1882 | 1887 | | |
1883 | 1888 | | |
| 1889 | + | |
1884 | 1890 | | |
1885 | 1891 | | |
1886 | 1892 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2489 | 2489 | | |
2490 | 2490 | | |
2491 | 2491 | | |
2492 | | - | |
2493 | | - | |
2494 | | - | |
2495 | | - | |
2496 | | - | |
2497 | | - | |
2498 | | - | |
| 2492 | + | |
| 2493 | + | |
| 2494 | + | |
| 2495 | + | |
| 2496 | + | |
| 2497 | + | |
| 2498 | + | |
| 2499 | + | |
2499 | 2500 | | |
2500 | 2501 | | |
2501 | 2502 | | |
| |||
2556 | 2557 | | |
2557 | 2558 | | |
2558 | 2559 | | |
2559 | | - | |
2560 | | - | |
| 2560 | + | |
| 2561 | + | |
| 2562 | + | |
| 2563 | + | |
| 2564 | + | |
| 2565 | + | |
| 2566 | + | |
2561 | 2567 | | |
2562 | | - | |
| 2568 | + | |
| 2569 | + | |
| 2570 | + | |
| 2571 | + | |
| 2572 | + | |
| 2573 | + | |
| 2574 | + | |
| 2575 | + | |
| 2576 | + | |
| 2577 | + | |
| 2578 | + | |
| 2579 | + | |
| 2580 | + | |
| 2581 | + | |
| 2582 | + | |
| 2583 | + | |
| 2584 | + | |
2563 | 2585 | | |
2564 | 2586 | | |
2565 | 2587 | | |
| |||
0 commit comments
Comments
(0)