GiST: range of penalty method? - Mailing list pgsql-hackers

From Neil Conway
Subject GiST: range of penalty method?
Date
Msg-id 1100062155.14777.29.camel@localhost.localdomain
Whole thread Raw
List pgsql-hackers
Does anyone know what the expected range of the "penalty" GiST method
is? (i.e. Is the legal range documented anywhere? Failing that, what
does existing GiST-based code expect?)

While rewriting gistchoose() in gist.c to be less obfuscated, it
occurred to me that (a) I don't think the existing code will work as
intended if a negative penalty is returned (b) it would be good to
define a "minimum legal penalty". Once the minimum penalty has been
returned for a particular location, GiST can know that all other
locations where it might insert the node will have a penalty greater
than or equal to that value, so gistchoose() can bail-out earlier.

Therefore, I'd like to make "0.0" is the minimum legal penalty, and
require all GiST "penalty" methods to return values >= 0. I think
requiring the penalty != NaN would also be a good idea. Comments?

Note that making this change to CVS tip results in a regression failure
in contrib/btree_gist. The regression.diffs are attached. The regression
tests for rtree_gist, tsearch, tsearch2 and pg_trgm succeed after making
the modification.

-Neil


Attachment

pgsql-hackers by date:

Previous
From: John Hansen
Date:
Subject: CREATE or REPLACE function pg_catalog.*
Next
From: Oleg Bartunov
Date:
Subject: Re: [Pgsphere-dev] GIST index concurrency concern