]> git.evergreen-ils.org Git - Evergreen.git/commit
LP#1730758: Track record visibility on all Located URI DML
authorMike Rylander <mrylander@gmail.com>
Wed, 6 Dec 2017 23:18:29 +0000 (18:18 -0500)
committerKathy Lussier <klussier@masslnc.org>
Wed, 10 Jan 2018 19:50:14 +0000 (14:50 -0500)
commit23b50266731d473db6f74dab2508d3e46b735c8b
treed308ce6f37b2e50f6da1579fbb9159680ef1a765
parent0027f5d5e67e7b2e6a5db26e9ac7025b529428e7
LP#1730758: Track record visibility on all Located URI DML

This commit simplifies the handling of Located URI call numbers by separating
them from normal call numbers.  This will allow proper updating of bib-level
visibility attributes for all actions that may happen to a Located URI.

We also insure that we don't return a NULL INT[] as an attribute set for
either copies or bibs.  This was always impossible for copies, but was
possible for bibs.  Now both are future-proof.

The upgrade script contains a post-transaction command to forcibly update the
visibility attributes of all bibs that make use of Located URIs or bib sources.
It may take a while to run on large datasets.  If it it running too long, it
can be canceled and the following psql commands will create and run a script
that will perform the same action serially over time without blocking writes to
bibs:

\t
\o /tmp/luri_visibility_update.sql
SELECT 'UPDATE biblio.record_entry SET ' ||
  'vis_attr_vector = biblio.calculate_bib_visibility_attribute_set(id) ' ||
  'WHERE id = ' || id || '; SELECT ' || id || ';'
FROM biblio.record_entry
  WHERE id IN (
            SELECT  DISTINCT cn.record
              FROM  asset.call_number cn
              WHERE NOT cn.deleted
                    AND cn.label = '##URI##'
                    AND EXISTS (
                        SELECT  1
                          FROM  asset.uri_call_number_map m
                          WHERE m.call_number = cn.id
                    )
                UNION
            SELECT id FROM biblio.record_entry WHERE source IS NOT NULL

        );
\o
\t
\i /tmp/luri_visibility_update.sql

It will output the id of each updated bib so that the script can be killed
and then edited to remove completed bibs.  The remainder can be run at a
later time.

NOTE: When the internal flag 'ingest.reingest.force_on_same_marc' is enabled,
we do NOT update the bib's visibility attributes, as doing so causes a loop
and an eventual trigger stack violation.  This flag should ONLY be used when
forcing reingest of record attributes (NOT visibility attributes), search,
facet, and display fields, so if using this flag under normal operation,
proceed at your own risk and know that Located URI and bib source changes
will not be reflected in the visibility attributes of the record.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/sql/Pg/300.schema.staged_search.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.function.luri_vis_cache.sql [new file with mode: 0644]