|
8 | 8 | * Portions Copyright (c) 1994, Regents of the University of California
|
9 | 9 | *
|
10 | 10 | * IDENTIFICATION
|
11 |
| - * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.76 2003/07/28 00:09:14 tgl Exp $ |
| 11 | + * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.77 2003/07/29 22:18:38 tgl Exp $ |
12 | 12 | *
|
13 | 13 | *-------------------------------------------------------------------------
|
14 | 14 | */
|
@@ -62,6 +62,13 @@ _bt_search(Relation rel, int keysz, ScanKey scankey,
|
62 | 62 | BlockNumber par_blkno;
|
63 | 63 | BTStack new_stack;
|
64 | 64 |
|
| 65 | + /* |
| 66 | + * Race -- the page we just grabbed may have split since we read |
| 67 | + * its pointer in the parent (or metapage). If it has, we may need |
| 68 | + * to move right to its new sibling. Do that. |
| 69 | + */ |
| 70 | + *bufP = _bt_moveright(rel, *bufP, keysz, scankey, BT_READ); |
| 71 | + |
65 | 72 | /* if this is a leaf page, we're done */
|
66 | 73 | page = BufferGetPage(*bufP);
|
67 | 74 | opaque = (BTPageOpaque) PageGetSpecialPointer(page);
|
@@ -99,13 +106,6 @@ _bt_search(Relation rel, int keysz, ScanKey scankey,
|
99 | 106 | _bt_relbuf(rel, *bufP);
|
100 | 107 | *bufP = _bt_getbuf(rel, blkno, BT_READ);
|
101 | 108 |
|
102 |
| - /* |
103 |
| - * Race -- the page we just grabbed may have split since we read |
104 |
| - * its pointer in the parent. If it has, we may need to move |
105 |
| - * right to its new sibling. Do that. |
106 |
| - */ |
107 |
| - *bufP = _bt_moveright(rel, *bufP, keysz, scankey, BT_READ); |
108 |
| - |
109 | 109 | /* okay, all set to move down a level */
|
110 | 110 | stack_in = new_stack;
|
111 | 111 | }
|
@@ -599,8 +599,8 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
|
599 | 599 | /*
|
600 | 600 | * At this point we are positioned at the first item >= scan key, or
|
601 | 601 | * possibly at the end of a page on which all the existing items are
|
602 |
| - * greater than the scan key and we know that everything on later |
603 |
| - * pages is less than or equal to scan key. |
| 602 | + * less than the scan key and we know that everything on later |
| 603 | + * pages is greater than or equal to scan key. |
604 | 604 | *
|
605 | 605 | * We could step forward in the latter case, but that'd be a waste of
|
606 | 606 | * time if we want to scan backwards. So, it's now time to examine
|
|
0 commit comments