forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitbc3087b
committed
Harmonize nbtree page split point code.
An nbtree split point can be thought of as a point between two adjoiningtuples from an imaginary version of the page being split that includesthe incoming/new item (in addition to the items that really are on thepage). These adjoining tuples are called the lastleft and firstrighttuples.The variables that represent split points contained a field calledfirstright, which is an offset number of the first data item from theoriginal page that goes on the new right page. The corresponding tuplefrom origpage was usually the same thing as the actual firstright tuple,but not always: the firstright tuple is sometimes the new/incoming iteminstead. This situation seems unnecessarily confusing.Make things clearer by renaming the origpage offset returned by_bt_findsplitloc() to "firstrightoff". We now have a firstright tupleand a firstrightoff offset number which are comparable to thenewitem/lastleft tuples and the newitemoff/lastleftoff offset numbersrespectively. Also make sure that we are consistent about how wedescribe nbtree page split point state.Push the responsibility for dealing with pg_upgrade'd !heapkeyspaceindexes down to lower level code, relieving _bt_split() from dealingwith it directly. This means that we always have a palloc'd left pagehigh key on the leaf level, no matter what. This enables simplifyingsome of the code (and code comments) within _bt_split().Finally, restructure the page split code to make it clearer why suffixtruncation (which only takes place during leaf page splits) iscompletely different to the first data item truncation that takes placeduring internal page splits. Tuples are marked as having fewerattributes stored in both cases, and the firstright tuple is truncatedin both cases, so it's easy to imagine somebody missing the distinction.1 parent8f00d84 commitbc3087b
File tree
8 files changed
+334
-291
lines changed- contrib/amcheck
- src
- backend/access
- nbtree
- rmgrdesc
- include/access
8 files changed
+334
-291
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1121 | 1121 |
| |
1122 | 1122 |
| |
1123 | 1123 |
| |
1124 |
| - | |
| 1124 | + | |
1125 | 1125 |
| |
1126 | 1126 |
| |
1127 | 1127 |
| |
|
Lines changed: 190 additions & 153 deletions
Large diffs are not rendered by default.
Lines changed: 22 additions & 20 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
269 | 269 |
| |
270 | 270 |
| |
271 | 271 |
| |
272 |
| - | |
| 272 | + | |
| 273 | + | |
273 | 274 |
| |
274 | 275 |
| |
275 | 276 |
| |
| |||
750 | 751 |
| |
751 | 752 |
| |
752 | 753 |
| |
753 |
| - | |
754 |
| - | |
755 |
| - | |
756 |
| - | |
| 754 | + | |
| 755 | + | |
757 | 756 |
| |
758 |
| - | |
759 |
| - | |
760 |
| - | |
761 |
| - | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
762 | 761 |
| |
763 | 762 |
| |
764 | 763 |
| |
765 | 764 |
| |
766 | 765 |
| |
767 |
| - | |
| 766 | + | |
| 767 | + | |
768 | 768 |
| |
769 |
| - | |
770 | 769 |
| |
771 | 770 |
| |
772 |
| - | |
| 771 | + | |
773 | 772 |
| |
774 | 773 |
| |
775 | 774 |
| |
| |||
867 | 866 |
| |
868 | 867 |
| |
869 | 868 |
| |
870 |
| - | |
871 |
| - | |
872 |
| - | |
873 |
| - | |
874 |
| - | |
875 |
| - | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
876 | 876 |
| |
877 | 877 |
| |
878 | 878 |
| |
| |||
925 | 925 |
| |
926 | 926 |
| |
927 | 927 |
| |
928 |
| - | |
| 928 | + | |
| 929 | + | |
929 | 930 |
| |
930 | 931 |
| |
931 | 932 |
| |
| |||
1054 | 1055 |
| |
1055 | 1056 |
| |
1056 | 1057 |
| |
1057 |
| - | |
| 1058 | + | |
| 1059 | + | |
1058 | 1060 |
| |
1059 | 1061 |
| |
1060 | 1062 |
| |
|
0 commit comments
Comments
(0)