Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3f34283

Browse files
Correct obsolete nbtree page split comment.
Commit 40dae7e, which made the nbtree page split algorithm more robust, made _bt_insert_parent() only unlock the right child of the parent page before inserting a new downlink into the parent. Update a comment from the Berkeley days claiming that both left and right child pages are unlocked before the new downlink actually gets inserted. The claim that it is okay to release both locks early based on Lehman and Yao's say-so never made much sense. Lehman and Yao must sometimes "couple" buffer locks across a pair of internal pages when relocating a downlink, unlike the corresponding code within _bt_getstack().
1 parent f1d85aa commit 3f34283

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/backend/access/nbtree/nbtinsert.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -908,8 +908,10 @@ _bt_insertonpg(Relation rel,
908908
*
909909
* We're ready to do the parent insertion. We need to hold onto the
910910
* locks for the child pages until we locate the parent, but we can
911-
* release them before doing the actual insertion (see Lehman and Yao
912-
* for the reasoning).
911+
* at least release the lock on the right child before doing the
912+
* actual insertion. The lock on the left child will be released
913+
* last of all by parent insertion, where it is the 'cbuf' of parent
914+
* page.
913915
*----------
914916
*/
915917
_bt_insert_parent(rel, buf, rbuf, stack, is_root, is_only);

0 commit comments

Comments
 (0)