Commit 2110f716 authored by Peter Geoghegan's avatar Peter Geoghegan

nbtree: Tweak _bt_pgaddtup() comments.

Make it clear that _bt_pgaddtup() truncates the first data item on an
internal page because its key is supposed to be treated as minus
infinity within _bt_compare().
parent bf2efc55
...@@ -2230,10 +2230,10 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf) ...@@ -2230,10 +2230,10 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
* *
* The main difference between this routine and a bare PageAddItem call * The main difference between this routine and a bare PageAddItem call
* is that this code knows that the leftmost index tuple on a non-leaf * is that this code knows that the leftmost index tuple on a non-leaf
* btree page doesn't need to have a key. Therefore, it strips such * btree page has a key that must be treated as minus infinity.
* tuples down to just the tuple header. CAUTION: this works ONLY if * Therefore, it truncates away all attributes. CAUTION: this works
* we insert the tuples in order, so that the given itup_off does * ONLY if we insert the tuples in order, so that the given itup_off
* represent the final position of the tuple! * does represent the final position of the tuple!
*/ */
static bool static bool
_bt_pgaddtup(Page page, _bt_pgaddtup(Page page,
...@@ -2248,7 +2248,6 @@ _bt_pgaddtup(Page page, ...@@ -2248,7 +2248,6 @@ _bt_pgaddtup(Page page,
{ {
trunctuple = *itup; trunctuple = *itup;
trunctuple.t_info = sizeof(IndexTupleData); trunctuple.t_info = sizeof(IndexTupleData);
/* Deliberately zero INDEX_ALT_TID_MASK bits */
BTreeTupleSetNAtts(&trunctuple, 0); BTreeTupleSetNAtts(&trunctuple, 0);
itup = &trunctuple; itup = &trunctuple;
itemsize = sizeof(IndexTupleData); itemsize = sizeof(IndexTupleData);
......
...@@ -756,9 +756,9 @@ _bt_slideleft(Page page) ...@@ -756,9 +756,9 @@ _bt_slideleft(Page page)
* Add an item to a page being built. * Add an item to a page being built.
* *
* The main difference between this routine and a bare PageAddItem call * The main difference between this routine and a bare PageAddItem call
* is that this code knows that the leftmost data item on a non-leaf * is that this code knows that the leftmost data item on a non-leaf btree
* btree page doesn't need to have a key. Therefore, it strips such * page has a key that must be treated as minus infinity. Therefore, it
* items down to just the item header. * truncates away all attributes.
* *
* This is almost like nbtinsert.c's _bt_pgaddtup(), but we can't use * This is almost like nbtinsert.c's _bt_pgaddtup(), but we can't use
* that because it assumes that P_RIGHTMOST() will return the correct * that because it assumes that P_RIGHTMOST() will return the correct
...@@ -778,7 +778,6 @@ _bt_sortaddtup(Page page, ...@@ -778,7 +778,6 @@ _bt_sortaddtup(Page page,
{ {
trunctuple = *itup; trunctuple = *itup;
trunctuple.t_info = sizeof(IndexTupleData); trunctuple.t_info = sizeof(IndexTupleData);
/* Deliberately zero INDEX_ALT_TID_MASK bits */
BTreeTupleSetNAtts(&trunctuple, 0); BTreeTupleSetNAtts(&trunctuple, 0);
itup = &trunctuple; itup = &trunctuple;
itemsize = sizeof(IndexTupleData); itemsize = sizeof(IndexTupleData);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment