Re: Small patch for GiST: move childoffnum to child

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Subject: Re: Small patch for GiST: move childoffnum to child
Date: 2011-07-15 08:12:48
Message-ID: 4E1FF680.4020703@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 14.07.2011 13:29, Alexander Korotkov wrote:
> On Thu, Jul 14, 2011 at 12:56 PM, Heikki Linnakangas<
> heikki(dot)linnakangas(at)enterprisedb(dot)com> wrote:
>
>> First, notice that we're setting "ptr->parent = top". 'top' is the current
>> node we're processing, and ptr represents the node to the right of the
>> current node. The current node is *not* the parent of the node to the right.
>> I believe that line should be "ptr->parent = top->parent".
>>
> I think same.
>
>> Second, we're adding the entry for the right sibling to the end of the list
>> of nodes to visit. But when we process entries from the list, we exit
>> immediately when we see a leaf page. That means that the right sibling can
>> get queued up behind leaf pages, and thus never visited.
>
> I think possible solution is to save right sibling immediatly after current
> page . Thus, this code fragment should looks like this:
>
>
>> if (top->parent&& XLByteLT(top->parent->lsn,
>> GistPageGetOpaque(page)->nsn)&&
>> GistPageGetOpaque(page)->**rightlink !=
>> InvalidBlockNumber /* sanity check */ )
>> {
>> /* page splited while we thinking of... */
>> ptr = (GISTInsertStack *) palloc0(sizeof(**
>> GISTInsertStack));
>> ptr->blkno = GistPageGetOpaque(page)->**rightlink;
>> ptr->childoffnum = InvalidOffsetNumber;
>> ptr->parent = top->parent;
>> ptr->next = top->next;
>> top->next = ptr;
>> if (tail == top);
>> tail = ptr;
>
> }

Agreed, committed. Thanks for verifying my thinking.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2011-07-15 09:09:42 Re: Patch Review: Collect frequency statistics and selectivity estimation for arrays
Previous Message Dave Page 2011-07-15 08:09:18 Re: pg_class.relistemp