Commit 6db4b49
committed
Fix wrong validation of top-parent pointer during page deletion in Btree.
After introducing usage of t_tid of inner or page high key for storing
number of attributes of tuple, validation of tuple's ItemPointer with
ItemPointerIsValid becomes incorrect, it's need to validate only blocknumber of
ItemPointer. Missing this causes a incorrect page deletion, fix that. Test is
added.
BTW, current contrib/amcheck doesn't fail on index corrupted by this way.
Also introduce BTreeTupleGetTopParent/BTreeTupleSetTopParent macroses to improve
code readability and to avoid possible confusion with page high key: high key
is used to store top-parent link for branch to remove.
Bug found by Michael Paquier, but bug doesn't exist in previous versions because
t_tid was set to P_HIKEY.
Author: Teodor Sigaev
Reviewer: Peter Geoghegan
Discussion: https://www.postgresql.org/message-id/flat/20180419052436.GA16000%40paquier.xyz1 parent 6a7b2ce commit 6db4b49
File tree
6 files changed
+46
-23
lines changed- src
- backend/access/nbtree
- include/access
- test/regress
- expected
- sql
6 files changed
+46
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1602 | 1602 | | |
1603 | 1603 | | |
1604 | 1604 | | |
1605 | | - | |
| 1605 | + | |
1606 | 1606 | | |
1607 | | - | |
1608 | | - | |
| 1607 | + | |
1609 | 1608 | | |
1610 | 1609 | | |
1611 | 1610 | | |
| |||
1690 | 1689 | | |
1691 | 1690 | | |
1692 | 1691 | | |
1693 | | - | |
| 1692 | + | |
1694 | 1693 | | |
1695 | 1694 | | |
1696 | 1695 | | |
| |||
1702 | 1701 | | |
1703 | 1702 | | |
1704 | 1703 | | |
1705 | | - | |
| 1704 | + | |
1706 | 1705 | | |
1707 | 1706 | | |
1708 | 1707 | | |
| |||
1714 | 1713 | | |
1715 | 1714 | | |
1716 | 1715 | | |
1717 | | - | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
1718 | 1719 | | |
1719 | | - | |
1720 | 1720 | | |
1721 | 1721 | | |
1722 | 1722 | | |
| |||
1919 | 1919 | | |
1920 | 1920 | | |
1921 | 1921 | | |
1922 | | - | |
1923 | | - | |
1924 | | - | |
1925 | | - | |
1926 | | - | |
1927 | | - | |
| 1922 | + | |
1928 | 1923 | | |
1929 | 1924 | | |
1930 | 1925 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
800 | 800 | | |
801 | 801 | | |
802 | 802 | | |
803 | | - | |
804 | | - | |
805 | | - | |
806 | | - | |
807 | | - | |
| 803 | + | |
808 | 804 | | |
809 | 805 | | |
810 | 806 | | |
| |||
912 | 908 | | |
913 | 909 | | |
914 | 910 | | |
915 | | - | |
916 | | - | |
917 | | - | |
918 | | - | |
919 | | - | |
| 911 | + | |
920 | 912 | | |
921 | 913 | | |
922 | 914 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
229 | 243 | | |
230 | 244 | | |
231 | 245 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3052 | 3052 | | |
3053 | 3053 | | |
3054 | 3054 | | |
| 3055 | + | |
| 3056 | + | |
| 3057 | + | |
| 3058 | + | |
| 3059 | + | |
| 3060 | + | |
| 3061 | + | |
| 3062 | + | |
| 3063 | + | |
| 3064 | + | |
3055 | 3065 | | |
3056 | 3066 | | |
3057 | 3067 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1061 | 1061 | | |
1062 | 1062 | | |
1063 | 1063 | | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
1064 | 1075 | | |
1065 | 1076 | | |
1066 | 1077 | | |
| |||
0 commit comments