[open-ils-commits] ***SPAM*** [GIT] Evergreen ILS branch master updated. f1fa38c29611f0e84d343d1543c3602cf6799b2b
Evergreen Git
git at git.evergreen-ils.org
Thu Apr 10 17:49:08 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 f1fa38c29611f0e84d343d1543c3602cf6799b2b (commit)
via d42fbecebddbb33bbb83fad4e7994d8b08237b76 (commit)
from 12319bb483d9a0d1e53db552b1f44f6866dcfea1 (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 f1fa38c29611f0e84d343d1543c3602cf6799b2b
Author: Ben Shum <bshum at biblio.org>
Date: Thu Apr 10 17:47:26 2014 -0400
LP#1304559 - stamping upgrade script for vandelay_record_attr_to_flat
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 e604c76..9b02560 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 ('0878', :eg_version); -- miker/dbwells/gmcharlt
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0879', :eg_version); -- dbwells/bshum
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.vandelay_record_attr_to_flat.sql b/Open-ILS/src/sql/Pg/upgrade/0879.function.vandelay_record_attr_to_flat.sql
similarity index 97%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.function.vandelay_record_attr_to_flat.sql
rename to Open-ILS/src/sql/Pg/upgrade/0879.function.vandelay_record_attr_to_flat.sql
index 12ab394..76afdf1 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.vandelay_record_attr_to_flat.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0879.function.vandelay_record_attr_to_flat.sql
@@ -1,6 +1,6 @@
BEGIN;
---SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+SELECT evergreen.upgrade_deps_block_check('0879', :eg_version);
CREATE OR REPLACE FUNCTION vandelay._get_expr_push_jrow(
node vandelay.match_set_point,
commit d42fbecebddbb33bbb83fad4e7994d8b08237b76
Author: Dan Wells <dbw2 at calvin.edu>
Date: Thu Apr 10 09:15:07 2014 -0400
LP#1304559 Fix slow Vandelay-based imports
Whether a planning limitation or otherwise, we have seen a few cases
where queries run very, very slowly (appear to hang) when using the
updated metabib.record_attr view in a WHERE clause.
The simplest code change is to switch Vandelay to use the intermediate
'_flat' view instead, and early reports indicate that this at least
gets us back to a functional state.
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/012.schema.vandelay.sql b/Open-ILS/src/sql/Pg/012.schema.vandelay.sql
index 5076037..9bfa491 100644
--- a/Open-ILS/src/sql/Pg/012.schema.vandelay.sql
+++ b/Open-ILS/src/sql/Pg/012.schema.vandelay.sql
@@ -713,8 +713,8 @@ BEGIN
jrow := jrow || ')) ' || my_alias || my_using || E'\n';
ELSE -- svf
jrow := jrow || 'id AS record, ' || node.quality ||
- ' AS quality FROM metabib.record_attr mra WHERE mra.attrs->''' ||
- node.svf || ''' ' || op || ' $2->''' || node.svf || ''') ' ||
+ ' AS quality FROM metabib.record_attr_flat mraf WHERE mraf.attr = ''' ||
+ node.svf || ''' AND mraf.value ' || op || ' $2->''' || node.svf || ''') ' ||
my_alias || my_using || E'\n';
END IF;
INSERT INTO _vandelay_tmp_jrows (j) VALUES (jrow);
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.vandelay_record_attr_to_flat.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.vandelay_record_attr_to_flat.sql
new file mode 100644
index 0000000..12ab394
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.vandelay_record_attr_to_flat.sql
@@ -0,0 +1,78 @@
+BEGIN;
+
+--SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+CREATE OR REPLACE FUNCTION vandelay._get_expr_push_jrow(
+ node vandelay.match_set_point,
+ tags_rstore HSTORE
+) RETURNS VOID AS $$
+DECLARE
+ jrow TEXT;
+ my_alias TEXT;
+ op TEXT;
+ tagkey TEXT;
+ caseless BOOL;
+ jrow_count INT;
+ my_using TEXT;
+ my_join TEXT;
+BEGIN
+ -- remember $1 is tags_rstore, and $2 is svf_rstore
+
+ caseless := FALSE;
+ SELECT COUNT(*) INTO jrow_count FROM _vandelay_tmp_jrows;
+ IF jrow_count > 0 THEN
+ my_using := ' USING (record)';
+ my_join := 'FULL OUTER JOIN';
+ ELSE
+ my_using := '';
+ my_join := 'FROM';
+ END IF;
+
+ IF node.tag IS NOT NULL THEN
+ caseless := (node.tag IN ('020', '022', '024'));
+ tagkey := node.tag;
+ IF node.subfield IS NOT NULL THEN
+ tagkey := tagkey || node.subfield;
+ END IF;
+ END IF;
+
+ IF node.negate THEN
+ IF caseless THEN
+ op := 'NOT LIKE';
+ ELSE
+ op := '<>';
+ END IF;
+ ELSE
+ IF caseless THEN
+ op := 'LIKE';
+ ELSE
+ op := '=';
+ END IF;
+ END IF;
+
+ my_alias := 'n' || node.id::TEXT;
+
+ jrow := my_join || ' (SELECT *, ';
+ IF node.tag IS NOT NULL THEN
+ jrow := jrow || node.quality ||
+ ' AS quality FROM metabib.full_rec mfr WHERE mfr.tag = ''' ||
+ node.tag || '''';
+ IF node.subfield IS NOT NULL THEN
+ jrow := jrow || ' AND mfr.subfield = ''' ||
+ node.subfield || '''';
+ END IF;
+ jrow := jrow || ' AND (';
+ jrow := jrow || vandelay._node_tag_comparisons(caseless, op, tags_rstore, tagkey);
+ jrow := jrow || ')) ' || my_alias || my_using || E'\n';
+ ELSE -- svf
+ jrow := jrow || 'id AS record, ' || node.quality ||
+ ' AS quality FROM metabib.record_attr_flat mraf WHERE mraf.attr = ''' ||
+ node.svf || ''' AND mraf.value ' || op || ' $2->''' || node.svf || ''') ' ||
+ my_alias || my_using || E'\n';
+ END IF;
+ INSERT INTO _vandelay_tmp_jrows (j) VALUES (jrow);
+END;
+$$ LANGUAGE PLPGSQL;
+
+COMMIT;
+
-----------------------------------------------------------------------
Summary of changes:
Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +-
Open-ILS/src/sql/Pg/012.schema.vandelay.sql | 4 +-
.../0879.function.vandelay_record_attr_to_flat.sql | 78 ++++++++++++++++++++
3 files changed, 81 insertions(+), 3 deletions(-)
create mode 100644 Open-ILS/src/sql/Pg/upgrade/0879.function.vandelay_record_attr_to_flat.sql
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list