From: | Peter Geoghegan <pg(at)bowt(dot)ie> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Removing unneeded downlink field from nbtree stack struct |
Date: | 2019-07-15 23:16:08 |
Message-ID: | CAH2-Wzmx+UbXt2YNOUCZ-a04VdXU=S=OHuAuD7Z8uQq-PXTYUg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Attached patch slightly simplifies _bt_getstackbuf() by making it
accept a child BlockNumber argument, rather than requiring that
callers store the child block number in the parent stack item's
bts_btentry field. We can remove the bts_btentry field from the
BTStackData struct, because we know where we ended up when we split a
page and need to relocate parent to insert new downlink -- it's only
truly necessary to remember what pivot tuple/downlink we followed to
arrive at the page being split. There is no point in remembering the
child block number during our initial descent of a B-Tree, since it's
never actually used at a later point, and can go stale immediately
after the buffer lock on parent is released. Besides,
_bt_getstackbuf() callers can even redefine the definition of child to
be child's right sibling after the descent is over. For example, this
happens when we move right, or when we step right during unique index
insertion.
This slightly simplifies the code. Our stack is inherently
approximate, because we might have to move right for a number of
reasons.
I'll add the patch to the 2019-09 CF.
--
Peter Geoghegan
Attachment | Content-Type | Size |
---|---|---|
0001-Remove-downlink-variable-from-nbtree-stack.patch | application/octet-stream | 8.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Munro | 2019-07-15 23:16:31 | Re: refactoring - share str2*int64 functions |
Previous Message | Karl O. Pinc | 2019-07-15 23:15:57 | Re: Patch to document base64 encoding |