Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2110f71

Browse files
nbtree: Tweak _bt_pgaddtup() comments.
Make it clear that _bt_pgaddtup() truncates the first data item on aninternal page because its key is supposed to be treated as minusinfinity within _bt_compare().
1 parentbf2efc5 commit2110f71

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

‎src/backend/access/nbtree/nbtinsert.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2230,10 +2230,10 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
22302230
*
22312231
*The main difference between this routine and a bare PageAddItem call
22322232
*is that this code knows that the leftmost index tuple on a non-leaf
2233-
*btree pagedoesn't need to havea key. Therefore, it strips such
2234-
*tuples down to just the tuple header. CAUTION: this works ONLY if
2235-
*we insert the tuples in order, so that the given itup_off does
2236-
*represent the final position of the tuple!
2233+
*btree pagehasa key that must be treated as minus infinity.
2234+
*Therefore, it truncates away all attributes. CAUTION: this works
2235+
*ONLY ifwe insert the tuples in order, so that the given itup_off
2236+
*doesrepresent the final position of the tuple!
22372237
*/
22382238
staticbool
22392239
_bt_pgaddtup(Pagepage,
@@ -2248,7 +2248,6 @@ _bt_pgaddtup(Page page,
22482248
{
22492249
trunctuple=*itup;
22502250
trunctuple.t_info=sizeof(IndexTupleData);
2251-
/* Deliberately zero INDEX_ALT_TID_MASK bits */
22522251
BTreeTupleSetNAtts(&trunctuple,0);
22532252
itup=&trunctuple;
22542253
itemsize=sizeof(IndexTupleData);

‎src/backend/access/nbtree/nbtsort.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -756,9 +756,9 @@ _bt_slideleft(Page page)
756756
* Add an item to a page being built.
757757
*
758758
* The main difference between this routine and a bare PageAddItem call
759-
* is that this code knows that the leftmost data item on a non-leaf
760-
*btreepagedoesn't need to have a key. Therefore, it strips such
761-
*items down to just the item header.
759+
* is that this code knows that the leftmost data item on a non-leaf btree
760+
* pagehas a key that must be treated as minus infinity. Therefore, it
761+
*truncates away all attributes.
762762
*
763763
* This is almost like nbtinsert.c's _bt_pgaddtup(), but we can't use
764764
* that because it assumes that P_RIGHTMOST() will return the correct
@@ -778,7 +778,6 @@ _bt_sortaddtup(Page page,
778778
{
779779
trunctuple=*itup;
780780
trunctuple.t_info=sizeof(IndexTupleData);
781-
/* Deliberately zero INDEX_ALT_TID_MASK bits */
782781
BTreeTupleSetNAtts(&trunctuple,0);
783782
itup=&trunctuple;
784783
itemsize=sizeof(IndexTupleData);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp