From: | Heikki Linnakangas <heikki(at)enterprisedb(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Dead code in _bt_split? |
Date: | 2006-12-07 23:18:34 |
Message-ID: | 4578A14A.9080005@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
Tom Lane wrote:
> "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com> writes:
>> This is right after a for-loop, which exits when i = maxoff + 1. So the
>> first if-statement could be written as "if (newitemoff > maxoff)". If
>> that's true, newitemonleft shouldn't be true, because that would mean
>> that we've split a page so that all items went to the left page, and the
>> right page is empty.
>
> No, it would mean that we split the page in such a way that only the new
> item is going to the right page. Probably not hard to duplicate if you
> use near-maximal-sized keys.
In that case, newitemleft would be false, right?
I'm saying the piece marked with X> below is unreachable:
> /* cope with possibility that newitem goes at the end */
> if (i <= newitemoff)
> {
> if (newitemonleft)
> {
X> _bt_pgaddtup(rel, leftpage, newitemsz, newitem, leftoff,
X> "left sibling");
X> itup_off = leftoff;
X> itup_blkno = BufferGetBlockNumber(buf);
X> leftoff = OffsetNumberNext(leftoff);
> }
> else
> {
> _bt_pgaddtup(rel, rightpage, newitemsz, newitem, rightoff,
> "right sibling");
> itup_off = rightoff;
> itup_blkno = BufferGetBlockNumber(rbuf);
> rightoff = OffsetNumberNext(rightoff);
> }
> }
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2006-12-07 23:49:46 | Re: Dead code in _bt_split? |
Previous Message | Tom Lane | 2006-12-07 23:05:09 | Re: Dead code in _bt_split? |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2006-12-07 23:49:46 | Re: Dead code in _bt_split? |
Previous Message | Tom Lane | 2006-12-07 23:05:09 | Re: Dead code in _bt_split? |