]> granicus.if.org Git - postgresql/commitdiff
Tweak some nbtree-related code comments.
authorPeter Geoghegan <pg@bowt.ie>
Fri, 29 Mar 2019 19:29:05 +0000 (12:29 -0700)
committerPeter Geoghegan <pg@bowt.ie>
Fri, 29 Mar 2019 19:29:05 +0000 (12:29 -0700)
contrib/amcheck/verify_nbtree.c
src/backend/access/nbtree/nbtsearch.c
src/backend/access/nbtree/nbtsort.c
src/include/access/nbtree.h

index 9ecb1999e34b40ce48a1962f1680043e46f2cb1f..9d5b2e5be67b71f525b1de0d1db627edf476fd71 100644 (file)
@@ -1975,7 +1975,7 @@ bt_normalize_tuple(BtreeCheckState *state, IndexTuple itup)
 /*
  * Search for itup in index, starting from fast root page.  itup must be a
  * non-pivot tuple.  This is only supported with heapkeyspace indexes, since
- * we rely on having fully unique keys to find a match with only a signle
+ * we rely on having fully unique keys to find a match with only a single
  * visit to a leaf page, barring an interrupted page split, where we may have
  * to move right.  (A concurrent page split is impossible because caller must
  * be readonly caller.)
index 7ed4e01bd39cb463f7d2b6281f8dbd88cf5200e3..8a5c6b3f2441bb6d4df81820e1e670cf02a03553 100644 (file)
@@ -182,7 +182,8 @@ _bt_search(Relation rel, BTScanInsert key, Buffer *bufP, int access,
 
        /*
         * If we're asked to lock leaf in write mode, but didn't manage to, then
-        * relock.  That may happen when the root page appears to be leaf.
+        * relock.  This should only happen when the root page is a leaf page (and
+        * the only page in the index other than the metapage).
         */
        if (access == BT_WRITE && page_access == BT_READ)
        {
index a8a7b792672c36b59c99ed7662919c5dc3149752..14d95457682555caf727b6b8c0f05b0dc7b34a0c 100644 (file)
@@ -835,7 +835,7 @@ _bt_buildadd(BTWriteState *wstate, BTPageState *state, IndexTuple itup)
         * the limit on the size of tuples inserted on the leaf level by the same
         * small amount.  Enforce the new v4+ limit on the leaf level, and the old
         * limit on internal levels, since pivot tuples may need to make use of
-        * the resered space.  This should never fail on internal pages.
+        * the reserved space.  This should never fail on internal pages.
         */
        if (unlikely(itupsz > BTMaxItemSize(npage)))
                _bt_check_third_page(wstate->index, wstate->heap,
@@ -907,8 +907,8 @@ _bt_buildadd(BTWriteState *wstate, BTPageState *state, IndexTuple itup)
                         * choosing a split point here for a benefit that is bound to be
                         * much smaller.
                         *
-                        * Since the truncated tuple is probably smaller than the
-                        * original, it cannot just be copied in place (besides, we want
+                        * Since the truncated tuple is often smaller than the original
+                        * tuple, it cannot just be copied in place (besides, we want
                         * to actually save space on the leaf page).  We delete the
                         * original high key, and add our own truncated high key at the
                         * same offset.  It's okay if the truncated tuple is slightly
index 473c6f29185fc8b791551f8985fefb4536c791b9..a1ffa983365c55ff1eb080bd7d9b83dcab518490 100644 (file)
@@ -219,7 +219,6 @@ typedef struct BTMetaPageData
 #define P_FIRSTDATAKEY(opaque) (P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY)
 
 /*
- *
  * Notes on B-Tree tuple format, and key and non-key attributes:
  *
  * INCLUDE B-Tree indexes have non-key attributes.  These are extra
@@ -321,7 +320,7 @@ typedef struct BTMetaPageData
 /*
  * Get/set number of attributes within B-tree index tuple.
  *
- * Note that this does not include an implicit tiebreaker heap-TID
+ * Note that this does not include an implicit tiebreaker heap TID
  * attribute, if any.  Note also that the number of key attributes must be
  * explicitly represented in all heapkeyspace pivot tuples.
  */
@@ -424,10 +423,10 @@ typedef struct BTStackData
 typedef BTStackData *BTStack;
 
 /*
- * BTScanInsert is the btree-private state needed to find an initial position
- * for an indexscan, or to insert new tuples -- an "insertion scankey" (not to
- * be confused with a search scankey).  It's used to descend a B-Tree using
- * _bt_search.
+ * BTScanInsertData is the btree-private state needed to find an initial
+ * position for an indexscan, or to insert new tuples -- an "insertion
+ * scankey" (not to be confused with a search scankey).  It's used to descend
+ * a B-Tree using _bt_search.
  *
  * heapkeyspace indicates if we expect all keys in the index to be physically
  * unique because heap TID is used as a tiebreaker attribute, and if index may