postgrespro.git / summary / log / commit / refs

commit    3f34283973a342aa1cb709d6e8f5cea430efcf29
Author:   Peter Geoghegan <pg@bowt.ie>
Date:     Tue Mar 12 23:40:05 2019 +0000

    Correct obsolete nbtree page split comment.
    
    Commit 40dae7ec537, 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().


src/backend/access/nbtree/nbtinsert.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c index 2b18028823..2997b1111a 100644 --- a/src/backend/access/nbtree/nbtinsert.c +++ b/src/backend/access/nbtree/nbtinsert.c @@ -908,8 +908,10 @@ _bt_insertonpg(Relation rel, * * We're ready to do the parent insertion. We need to hold onto the * locks for the child pages until we locate the parent, but we can - * release them before doing the actual insertion (see Lehman and Yao - * for the reasoning). + * at least release the lock on the right child before doing the + * actual insertion. The lock on the left child will be released + * last of all by parent insertion, where it is the 'cbuf' of parent + * page. *---------- */ _bt_insert_parent(rel, buf, rbuf, stack, is_root, is_only); [parent: f1d85aa98ee7]