]> granicus.if.org Git - postgresql/commit
Fix GiST buffering build bug, which caused "failed to re-find parent" errors.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 16 Aug 2012 09:42:11 +0000 (12:42 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 16 Aug 2012 09:58:54 +0000 (12:58 +0300)
commitd6524697dba5967c7951c9a47107054660804900
tree8558b63536bb218194de8f531787c01907cd8586
parentcaf97eb72e2e08378aefdd8f75c10b73fd04172b
Fix GiST buffering build bug, which caused "failed to re-find parent" errors.

We use a hash table to track the parents of inner pages, but when inserting
to a leaf page, the caller of gistbufferinginserttuples() must pass a
correct block number of the leaf's parent page. Before gistProcessItup()
descends to a child page, it checks if the downlink needs to be adjusted to
accommodate the new tuple, and updates the downlink if necessary. However,
updating the downlink might require splitting the page, which might move the
downlink to a page to the right. gistProcessItup() doesn't realize that, so
when it descends to the leaf page, it might pass an out-of-date parent block
number as a result. Fix that by returning the block a tuple was inserted to
from gistbufferinginserttuples().

This fixes the bug reported by Zdeněk Jílovec.
src/backend/access/gist/gist.c
src/backend/access/gist/gistbuild.c
src/include/access/gist_private.h