[open-ils-commits] ***SPAM*** [GIT] Evergreen ILS branch master updated. 4ffa6220773038b7c8956612479b074e3803b56d

Evergreen Git git at git.evergreen-ils.org
Tue Mar 18 22:47:39 EDT 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  4ffa6220773038b7c8956612479b074e3803b56d (commit)
       via  fa417ff21862e05cbf12d98e45acc919c5755596 (commit)
       via  3f0411f5968a17bfe87ad4203f6d8760e9cd68fd (commit)
       via  cccf8938f544d82a47b6df5c8c918a53e1aff728 (commit)
      from  7e488141a61b30f431a6cf551922aaa2863bc77d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 4ffa6220773038b7c8956612479b074e3803b56d
Author: Ben Shum <bshum at biblio.org>
Date:   Tue Mar 18 22:44:56 2014 -0400

    LP#1253163: stamping upgrade for authority.in-line-headings
    
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 7c30be7..be95f68 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -91,7 +91,7 @@ CREATE TRIGGER no_overlapping_deps
     BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
     FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
 
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0874', :eg_version); -- dbwells/bshum
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0875', :eg_version); -- miker/dbwells/bshum
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.authority.in-line-headings.sql b/Open-ILS/src/sql/Pg/upgrade/0875.schema.authority.in-line-headings.sql
similarity index 97%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.schema.authority.in-line-headings.sql
rename to Open-ILS/src/sql/Pg/upgrade/0875.schema.authority.in-line-headings.sql
index 3b68093..6fd43d0 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.authority.in-line-headings.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0875.schema.authority.in-line-headings.sql
@@ -7,7 +7,7 @@ ALTER TABLE authority.record_entry DISABLE TRIGGER map_thesaurus_to_control_set;
 
 BEGIN;
 
---SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+SELECT evergreen.upgrade_deps_block_check('0875', :eg_version);
 
 ALTER TABLE authority.record_entry ADD COLUMN heading TEXT, ADD COLUMN simple_heading TEXT;
 

commit fa417ff21862e05cbf12d98e45acc919c5755596
Author: Dan Wells <dbw2 at calvin.edu>
Date:   Mon Mar 17 16:47:55 2014 -0400

    LP#1253163: Replace dropped unique index, if we can
    
    Not sure if this is necessary, but since we drop this index, we might
    want to make an effort to recreate it if we can (but don't die if we
    cannot).
    
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.authority.in-line-headings.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.authority.in-line-headings.sql
index 64fe5f6..3b68093 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.authority.in-line-headings.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.authority.in-line-headings.sql
@@ -41,6 +41,12 @@ ALTER FUNCTION authority.simple_heading_set(TEXT) STABLE STRICT;
 
 COMMIT;
 
+\qecho .
+\qecho This index might fail, and is outside the transaction for that reason.
+\qecho If it fails, you probably did not have it in the first place.
+\qecho .
+CREATE UNIQUE INDEX unique_by_heading_and_thesaurus ON authority.record_entry (heading) WHERE deleted IS FALSE or deleted = FALSE;
+
 ALTER TABLE authority.record_entry ENABLE TRIGGER a_marcxml_is_well_formed;
 ALTER TABLE authority.record_entry ENABLE TRIGGER aaa_auth_ingest_or_delete;
 ALTER TABLE authority.record_entry ENABLE TRIGGER b_maintain_901;

commit 3f0411f5968a17bfe87ad4203f6d8760e9cd68fd
Author: Dan Wells <dbw2 at calvin.edu>
Date:   Mon Mar 17 13:03:49 2014 -0400

    LP#1253163: Make authority functions more truthful
    
    One discovery we made on this bug was that PG can break if we
    conveniently label functions as IMMUTABLE when they are now.  Let's
    go ahead and reclass some authority functions as STABLE STRICT to
    better fit reality.
    
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/src/sql/Pg/011.schema.authority.sql b/Open-ILS/src/sql/Pg/011.schema.authority.sql
index 99f21ea..bb4aca0 100644
--- a/Open-ILS/src/sql/Pg/011.schema.authority.sql
+++ b/Open-ILS/src/sql/Pg/011.schema.authority.sql
@@ -299,7 +299,7 @@ BEGIN
 
     RETURN heading_text;
 END;
-$func$ LANGUAGE PLPGSQL IMMUTABLE;
+$func$ LANGUAGE PLPGSQL STABLE STRICT;
 
 CREATE TABLE authority.simple_heading (
     id              BIGSERIAL   PRIMARY KEY,
@@ -394,15 +394,15 @@ BEGIN
 
     RETURN;
 END;
-$func$ LANGUAGE PLPGSQL IMMUTABLE;
+$func$ LANGUAGE PLPGSQL STABLE STRICT;
 
 CREATE OR REPLACE FUNCTION authority.simple_normalize_heading( marcxml TEXT ) RETURNS TEXT AS $func$
     SELECT authority.normalize_heading($1, TRUE);
-$func$ LANGUAGE SQL IMMUTABLE;
+$func$ LANGUAGE SQL STABLE STRICT;
 
 CREATE OR REPLACE FUNCTION authority.normalize_heading( marcxml TEXT ) RETURNS TEXT AS $func$
     SELECT authority.normalize_heading($1, FALSE);
-$func$ LANGUAGE SQL IMMUTABLE;
+$func$ LANGUAGE SQL STABLE STRICT;
 
 COMMENT ON FUNCTION authority.normalize_heading( TEXT ) IS $$
 Extract the authority heading, thesaurus, and NACO-normalized values
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.authority.in-line-headings.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.authority.in-line-headings.sql
index 47fb7f2..64fe5f6 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.authority.in-line-headings.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.authority.in-line-headings.sql
@@ -7,7 +7,7 @@ ALTER TABLE authority.record_entry DISABLE TRIGGER map_thesaurus_to_control_set;
 
 BEGIN;
 
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+--SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
 
 ALTER TABLE authority.record_entry ADD COLUMN heading TEXT, ADD COLUMN simple_heading TEXT;
 
@@ -34,6 +34,11 @@ $f$ LANGUAGE PLPGSQL;
 
 CREATE TRIGGER update_headings_tgr BEFORE INSERT OR UPDATE ON authority.record_entry FOR EACH ROW EXECUTE PROCEDURE authority.normalize_heading_for_upsert();
 
+ALTER FUNCTION authority.normalize_heading(TEXT, BOOL) STABLE STRICT;
+ALTER FUNCTION authority.normalize_heading(TEXT) STABLE STRICT;
+ALTER FUNCTION authority.simple_normalize_heading(TEXT) STABLE STRICT;
+ALTER FUNCTION authority.simple_heading_set(TEXT) STABLE STRICT;
+
 COMMIT;
 
 ALTER TABLE authority.record_entry ENABLE TRIGGER a_marcxml_is_well_formed;

commit cccf8938f544d82a47b6df5c8c918a53e1aff728
Author: Mike Rylander <mrylander at gmail.com>
Date:   Fri Feb 28 16:45:40 2014 -0500

    LP#1253163: Materialize authority headings
    
    There seems to be a bug in Postgres 9.3+ that does not like the
    circuitous route we take to indexing authority headings.  So, we
    get around this by storing the actual heading values instead of
    indexing a function over the MARC.
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Authority.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Authority.pm
index d0e52aa..d1f42d7 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Authority.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Authority.pm
@@ -71,10 +71,9 @@ sub search_authority_by_simple_normalize_heading {
         from   => 'are',
         where  => {
             deleted => 'f',
-            marc => { 'startwith' => {
-                transform => 'authority.simple_normalize_heading',
-                value     => [ 'authority.simple_normalize_heading' => $marcxml ]
-            }},
+            simple_heading => {
+                'startwith' => [ 'authority.simple_normalize_heading' => $marcxml ]
+            },
             defined($controlset) ? ( control_set => $controlset ) : ()
         }
     };
diff --git a/Open-ILS/src/sql/Pg/000.english.pg93.fts-config.sql b/Open-ILS/src/sql/Pg/000.english.pg93.fts-config.sql
new file mode 120000
index 0000000..0b24fd9
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/000.english.pg93.fts-config.sql
@@ -0,0 +1 @@
+000.english.pg91.fts-config.sql
\ No newline at end of file
diff --git a/Open-ILS/src/sql/Pg/011.schema.authority.sql b/Open-ILS/src/sql/Pg/011.schema.authority.sql
index d3527f2..99f21ea 100644
--- a/Open-ILS/src/sql/Pg/011.schema.authority.sql
+++ b/Open-ILS/src/sql/Pg/011.schema.authority.sql
@@ -131,7 +131,9 @@ CREATE TABLE authority.record_entry (
     control_set     INT     REFERENCES authority.control_set (id) ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,
     marc            TEXT    NOT NULL,
     last_xact_id    TEXT    NOT NULL,
-    owner           INT
+    owner           INT,
+    heading         TEXT,
+    simple_heading  TEXT
 );
 CREATE INDEX authority_record_entry_creator_idx ON authority.record_entry ( creator );
 CREATE INDEX authority_record_entry_editor_idx ON authority.record_entry ( editor );
@@ -207,7 +209,7 @@ CREATE RULE protect_authority_rec_delete AS ON DELETE TO authority.record_entry
 
 -- Intended to be used in a unique index on authority.record_entry like so:
 -- CREATE UNIQUE INDEX unique_by_heading_and_thesaurus
---   ON authority.record_entry (authority.normalize_heading(marc))
+--   ON authority.record_entry (heading)
 --   WHERE deleted IS FALSE or deleted = FALSE;
 CREATE OR REPLACE FUNCTION authority.normalize_heading( marcxml TEXT, no_thesaurus BOOL ) RETURNS TEXT AS $func$
 DECLARE
@@ -409,6 +411,17 @@ index to defend against duplicated authority records from the same
 thesaurus.
 $$;
 
+-- Store these in line with the MARC for easier indexing
+CREATE OR REPLACE FUNCTION authority.normalize_heading_for_upsert () RETURNS TRIGGER AS $f$
+BEGIN
+    NEW.heading := authority.normalize_heading( NEW.marc );
+    NEW.simple_heading := authority.simple_normalize_heading( NEW.marc );
+    RETURN NEW;
+END;
+$f$ LANGUAGE PLPGSQL;
+
+CREATE TRIGGER update_headings_tgr BEFORE INSERT OR UPDATE ON authority.record_entry FOR EACH ROW EXECUTE PROCEDURE authority.normalize_heading_for_upsert();
+
 -- Adding indexes using oils_xpath_string() for the main entry tags described in
 -- authority.control_set_authority_field would speed this up, if we ever want to use it, though
 -- the existing index on authority.normalize_heading() helps already with a record in hand
@@ -424,7 +437,7 @@ CREATE OR REPLACE VIEW authority.tracing_links AS
             link.id AS link_id,
             link.tag AS link_tag,
             oils_xpath_string('//*[@tag="'||link.tag||'"]/*[local-name()="subfield"]', are.marc) AS link_value,
-            authority.normalize_heading(are.marc) AS normalized_main_value
+            are.heading AS normalized_main_value
       FROM  authority.full_rec main
             JOIN authority.record_entry are ON (main.record = are.id)
             JOIN authority.control_set_authority_field main_entry
diff --git a/Open-ILS/src/sql/Pg/800.fkeys.sql b/Open-ILS/src/sql/Pg/800.fkeys.sql
index 151cacb..ee9886d 100644
--- a/Open-ILS/src/sql/Pg/800.fkeys.sql
+++ b/Open-ILS/src/sql/Pg/800.fkeys.sql
@@ -128,8 +128,8 @@ ALTER TABLE config.org_unit_setting_type ADD CONSTRAINT update_perm_fkey FOREIGN
 
 ALTER TABLE config.barcode_completion ADD CONSTRAINT config_barcode_completion_org_unit_fkey FOREIGN KEY (org_unit) REFERENCES actor.org_unit (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
 
-CREATE INDEX by_heading_and_thesaurus ON authority.record_entry (authority.normalize_heading(marc)) WHERE deleted IS FALSE or deleted = FALSE;
-CREATE INDEX by_heading ON authority.record_entry (authority.simple_normalize_heading(marc)) WHERE deleted IS FALSE or deleted = FALSE;
+CREATE INDEX by_heading_and_thesaurus ON authority.record_entry (heading) WHERE deleted IS FALSE or deleted = FALSE;
+CREATE INDEX by_heading ON authority.record_entry (simple_heading) WHERE deleted IS FALSE or deleted = FALSE;
 
 ALTER TABLE config.z3950_source ADD CONSTRAINT use_perm_fkey FOREIGN KEY (use_perm) REFERENCES permission.perm_list (id) ON UPDATE CASCADE ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED;
 
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.authority.in-line-headings.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.authority.in-line-headings.sql
new file mode 100644
index 0000000..47fb7f2
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.authority.in-line-headings.sql
@@ -0,0 +1,45 @@
+
+ALTER TABLE authority.record_entry DISABLE TRIGGER a_marcxml_is_well_formed;
+ALTER TABLE authority.record_entry DISABLE TRIGGER aaa_auth_ingest_or_delete;
+ALTER TABLE authority.record_entry DISABLE TRIGGER b_maintain_901;
+ALTER TABLE authority.record_entry DISABLE TRIGGER c_maintain_control_numbers;
+ALTER TABLE authority.record_entry DISABLE TRIGGER map_thesaurus_to_control_set;
+
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+ALTER TABLE authority.record_entry ADD COLUMN heading TEXT, ADD COLUMN simple_heading TEXT;
+
+DROP INDEX IF EXISTS authority.unique_by_heading_and_thesaurus;
+DROP INDEX IF EXISTS authority.by_heading_and_thesaurus;
+DROP INDEX IF EXISTS authority.by_heading;
+
+-- Update without indexes for HOT update
+UPDATE  authority.record_entry
+  SET   heading = authority.normalize_heading( marc ),
+        simple_heading = authority.simple_normalize_heading( marc );
+
+CREATE INDEX by_heading_and_thesaurus ON authority.record_entry (heading) WHERE deleted IS FALSE or deleted = FALSE;
+CREATE INDEX by_heading ON authority.record_entry (simple_heading) WHERE deleted IS FALSE or deleted = FALSE;
+
+-- Add the trigger
+CREATE OR REPLACE FUNCTION authority.normalize_heading_for_upsert () RETURNS TRIGGER AS $f$
+BEGIN
+    NEW.heading := authority.normalize_heading( NEW.marc );
+    NEW.simple_heading := authority.simple_normalize_heading( NEW.marc );
+    RETURN NEW;
+END;
+$f$ LANGUAGE PLPGSQL;
+
+CREATE TRIGGER update_headings_tgr BEFORE INSERT OR UPDATE ON authority.record_entry FOR EACH ROW EXECUTE PROCEDURE authority.normalize_heading_for_upsert();
+
+COMMIT;
+
+ALTER TABLE authority.record_entry ENABLE TRIGGER a_marcxml_is_well_formed;
+ALTER TABLE authority.record_entry ENABLE TRIGGER aaa_auth_ingest_or_delete;
+ALTER TABLE authority.record_entry ENABLE TRIGGER b_maintain_901;
+ALTER TABLE authority.record_entry ENABLE TRIGGER c_maintain_control_numbers;
+ALTER TABLE authority.record_entry ENABLE TRIGGER map_thesaurus_to_control_set;
+
+

-----------------------------------------------------------------------

Summary of changes:
 .../lib/OpenILS/Application/Search/Authority.pm    |    7 +--
 ...-config.sql => 000.english.pg93.fts-config.sql} |    0
 Open-ILS/src/sql/Pg/002.schema.config.sql          |    2 +-
 Open-ILS/src/sql/Pg/011.schema.authority.sql       |   27 +++++++---
 Open-ILS/src/sql/Pg/800.fkeys.sql                  |    4 +-
 .../0875.schema.authority.in-line-headings.sql     |   56 ++++++++++++++++++++
 6 files changed, 82 insertions(+), 14 deletions(-)
 copy Open-ILS/src/sql/Pg/{000.english.pg92.fts-config.sql => 000.english.pg93.fts-config.sql} (100%)
 create mode 100644 Open-ILS/src/sql/Pg/upgrade/0875.schema.authority.in-line-headings.sql


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list