Skip to content

Commit 9c7fb7e

Browse files
Tweak some nbtree-related code comments.
1 parent d85e0f3 commit 9c7fb7e

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

contrib/amcheck/verify_nbtree.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1975,7 +1975,7 @@ bt_normalize_tuple(BtreeCheckState *state, IndexTuple itup)
19751975
/*
19761976
* Search for itup in index, starting from fast root page. itup must be a
19771977
* non-pivot tuple. This is only supported with heapkeyspace indexes, since
1978-
* we rely on having fully unique keys to find a match with only a signle
1978+
* we rely on having fully unique keys to find a match with only a single
19791979
* visit to a leaf page, barring an interrupted page split, where we may have
19801980
* to move right. (A concurrent page split is impossible because caller must
19811981
* be readonly caller.)

src/backend/access/nbtree/nbtsearch.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ _bt_search(Relation rel, BTScanInsert key, Buffer *bufP, int access,
182182

183183
/*
184184
* If we're asked to lock leaf in write mode, but didn't manage to, then
185-
* relock. That may happen when the root page appears to be leaf.
185+
* relock. This should only happen when the root page is a leaf page (and
186+
* the only page in the index other than the metapage).
186187
*/
187188
if (access == BT_WRITE && page_access == BT_READ)
188189
{

src/backend/access/nbtree/nbtsort.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ _bt_buildadd(BTWriteState *wstate, BTPageState *state, IndexTuple itup)
835835
* the limit on the size of tuples inserted on the leaf level by the same
836836
* small amount. Enforce the new v4+ limit on the leaf level, and the old
837837
* limit on internal levels, since pivot tuples may need to make use of
838-
* the resered space. This should never fail on internal pages.
838+
* the reserved space. This should never fail on internal pages.
839839
*/
840840
if (unlikely(itupsz > BTMaxItemSize(npage)))
841841
_bt_check_third_page(wstate->index, wstate->heap,
@@ -907,8 +907,8 @@ _bt_buildadd(BTWriteState *wstate, BTPageState *state, IndexTuple itup)
907907
* choosing a split point here for a benefit that is bound to be
908908
* much smaller.
909909
*
910-
* Since the truncated tuple is probably smaller than the
911-
* original, it cannot just be copied in place (besides, we want
910+
* Since the truncated tuple is often smaller than the original
911+
* tuple, it cannot just be copied in place (besides, we want
912912
* to actually save space on the leaf page). We delete the
913913
* original high key, and add our own truncated high key at the
914914
* same offset. It's okay if the truncated tuple is slightly

src/include/access/nbtree.h

+5-6
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ typedef struct BTMetaPageData
219219
#define P_FIRSTDATAKEY(opaque) (P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY)
220220

221221
/*
222-
*
223222
* Notes on B-Tree tuple format, and key and non-key attributes:
224223
*
225224
* INCLUDE B-Tree indexes have non-key attributes. These are extra
@@ -321,7 +320,7 @@ typedef struct BTMetaPageData
321320
/*
322321
* Get/set number of attributes within B-tree index tuple.
323322
*
324-
* Note that this does not include an implicit tiebreaker heap-TID
323+
* Note that this does not include an implicit tiebreaker heap TID
325324
* attribute, if any. Note also that the number of key attributes must be
326325
* explicitly represented in all heapkeyspace pivot tuples.
327326
*/
@@ -424,10 +423,10 @@ typedef struct BTStackData
424423
typedef BTStackData *BTStack;
425424

426425
/*
427-
* BTScanInsert is the btree-private state needed to find an initial position
428-
* for an indexscan, or to insert new tuples -- an "insertion scankey" (not to
429-
* be confused with a search scankey). It's used to descend a B-Tree using
430-
* _bt_search.
426+
* BTScanInsertData is the btree-private state needed to find an initial
427+
* position for an indexscan, or to insert new tuples -- an "insertion
428+
* scankey" (not to be confused with a search scankey). It's used to descend
429+
* a B-Tree using _bt_search.
431430
*
432431
* heapkeyspace indicates if we expect all keys in the index to be physically
433432
* unique because heap TID is used as a tiebreaker attribute, and if index may

0 commit comments

Comments
 (0)