@@ -2036,8 +2036,8 @@ _bt_steppage(IndexScanDesc scan, ScanDirection dir)
2036
2036
* _bt_readnextpage() -- Read next page containing valid data for scan
2037
2037
*
2038
2038
* On success exit, so->currPos is updated to contain data from the next
2039
- * interesting page. Caller is responsible to release lock and pin on
2040
- * buffer on success. We return true to indicate success.
2039
+ * interesting page, and we return true. Caller must release the lock ( and
2040
+ * maybe the pin) on the buffer on success exit .
2041
2041
*
2042
2042
* If there are no more matching records in the given direction, we drop all
2043
2043
* locks and pins, set so->currPos.buf to InvalidBuffer, and return false.
@@ -2127,18 +2127,9 @@ _bt_readnextpage(IndexScanDesc scan, BlockNumber blkno, ScanDirection dir)
2127
2127
*
2128
2128
* It might be possible to rearrange this code to have less overhead
2129
2129
* in pinning and locking, but that would require capturing the left
2130
- * pointer when the page is initially read, and using it here, along
2131
- * with big changes to _bt_walk_left() and the code below. It is not
2132
- * clear whether this would be a win, since if the page immediately to
2133
- * the left splits after we read this page and before we step left, we
2134
- * would need to visit more pages than with the current code.
2135
- *
2136
- * Note that if we change the code so that we drop the pin for a scan
2137
- * which uses a non-MVCC snapshot, we will need to modify the code for
2138
- * walking left, to allow for the possibility that a referenced page
2139
- * has been deleted. As long as the buffer is pinned or the snapshot
2140
- * is MVCC the page cannot move past the half-dead state to fully
2141
- * deleted.
2130
+ * sibling block number when the page is initially read, and then
2131
+ * optimistically starting there (rather than pinning the page twice).
2132
+ * It is not clear that this would be worth the complexity.
2142
2133
*/
2143
2134
if (BTScanPosIsPinned (so -> currPos ))
2144
2135
_bt_lockbuf (rel , so -> currPos .buf , BT_READ );
@@ -2243,9 +2234,8 @@ _bt_parallel_readpage(IndexScanDesc scan, BlockNumber blkno, ScanDirection dir)
2243
2234
* Returns InvalidBuffer if there is no page to the left (no lock is held
2244
2235
* in that case).
2245
2236
*
2246
- * When working on a non-leaf level, it is possible for the returned page
2247
- * to be half-dead; the caller should check that condition and step left
2248
- * again if it's important.
2237
+ * It is possible for the returned leaf page to be half-dead; caller must
2238
+ * check that condition and step left again when required.
2249
2239
*/
2250
2240
static Buffer
2251
2241
_bt_walk_left (Relation rel , Buffer buf )
@@ -2288,8 +2278,7 @@ _bt_walk_left(Relation rel, Buffer buf)
2288
2278
* anymore, not that its left sibling got split more than four times.
2289
2279
*
2290
2280
* Note that it is correct to test P_ISDELETED not P_IGNORE here,
2291
- * because half-dead pages are still in the sibling chain. Caller
2292
- * must reject half-dead pages if wanted.
2281
+ * because half-dead pages are still in the sibling chain.
2293
2282
*/
2294
2283
tries = 0 ;
2295
2284
for (;;)
0 commit comments