]> git.evergreen-ils.org Git - Evergreen.git/commit
LP#1651808: avoid a class of intermittent search failures
authorGalen Charlton <gmc@esilibrary.com>
Wed, 21 Dec 2016 21:32:26 +0000 (16:32 -0500)
committerMike Rylander <mrylander@gmail.com>
Wed, 21 Dec 2016 22:10:43 +0000 (17:10 -0500)
commit0382522b2b87679d365bf9000ea40d7fdf8ca1c0
tree969a39a68a6eac20881b4470baceafac7b05e6f1
parent72aaaa32ffa3be9b6cbda8bf5276244e9f485222
LP#1651808: avoid a class of intermittent search failures

This patch fixes a bug where catalog searches can sometimes fail
with a PostgreSQL error that looks like this:

ERROR: type of parameter 56 (double precision) does not match that when preparing the plan (numeric)
CONTEXT: PL/pgSQL function search.query_parser_fts(integer,integer,text,integer[],integer[],integer,integer,integer,boolean,boolean,boolean,integer) line 319 at assignment

In particular, it ensures that the relevance values are coerced
to the Pg NUMERIC data type regardless of how the core query is
constructed; otherwise, it can sometimes end up as a double
precision value.  Because of how Pg backends cache query plans,
that change of type can result in the error above.

To test
-------
[1] (Optional) Configure the max_children values for open-ils.storage
    to permit only one drone, which in turn forces all catalog
    search requests to go through a single Pg backend.
[2] Set the default_preferred_language_weight opensrf.xml setting
    to 0.
[3] Perform a catalog search that has just a filter, e.g.,
    item_lang(eng).
[4] Perform a catalog search that includes search term, e.g.,
    cats
[5] The second search should fail.
[6] Apply the patch and try steps 3 and 4 again; this time, both
    searches should work.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Conflicts:
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm