Fix logic bug in gistchoose and gistRelocateBuildBuffersOnSplit.
authorRobert Haas <rhaas@postgresql.org>
Thu, 30 Aug 2012 17:05:45 +0000 (13:05 -0400)
committerRobert Haas <rhaas@postgresql.org>
Thu, 30 Aug 2012 17:09:07 +0000 (13:09 -0400)
commitc8ba697a4bdb934f0c51424c654e8db6133ea255
tree8d8ed4a104a58708f3b0b51d9288e62b0f549f4b
parentd1a4db8d25ec53fd17e99168bc5efa0b16ef6fed
Fix logic bug in gistchoose and gistRelocateBuildBuffersOnSplit.

Every time the best-tuple-found-so-far changes, we need to reset all
the penalty values in which_grow[] to the penalties for the new best
tuple.  The old code failed to do this, resulting in inferior index
quality.

The original patch from Alexander Korotkov was just two lines; I took
the liberty of fleshing that out by adding a bunch of comments that I
hope will make this logic easier for others to understand than it was
for me.
src/backend/access/gist/gistbuildbuffers.c
src/backend/access/gist/gistutil.c