Re: Small patch for GiST: move childoffnum to child
От | Heikki Linnakangas |
---|---|
Тема | Re: Small patch for GiST: move childoffnum to child |
Дата | |
Msg-id | 4E1EAF5A.1010108@enterprisedb.com обсуждение исходный текст |
Ответ на | Re: Small patch for GiST: move childoffnum to child (Alexander Korotkov <aekorotkov@gmail.com>) |
Ответы |
Re: Small patch for GiST: move childoffnum to child
|
Список | pgsql-hackers |
I think there's two bugs in the existing gistFindPath code: > 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; > ptr->next = NULL; > tail->next = ptr; > tail = ptr; > } 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". 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. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com
В списке pgsql-hackers по дате отправления: