[open-ils-commits] [GIT] Evergreen ILS branch rel_2_10 updated. fcb79fdd84ade0249f0d835a129eb3a328ebbeb5

Evergreen Git git at git.evergreen-ils.org
Wed Nov 16 15:21:51 EST 2016


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, rel_2_10 has been updated
       via  fcb79fdd84ade0249f0d835a129eb3a328ebbeb5 (commit)
       via  be89bb3c899f1690da167417224d0de06013576e (commit)
      from  5ce99ef9b7dd4fb388a3b0828bab437f561dca5e (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 fcb79fdd84ade0249f0d835a129eb3a328ebbeb5
Author: Galen Charlton <gmc at esilibrary.com>
Date:   Wed Nov 16 15:21:10 2016 -0500

    bump up upgrade instructions for 2.10.8
    
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/docs/installation/server_upgrade.txt b/docs/installation/server_upgrade.txt
index d8fd241..e60a221 100644
--- a/docs/installation/server_upgrade.txt
+++ b/docs/installation/server_upgrade.txt
@@ -8,7 +8,7 @@ Software Prerequisites
 
  * **PostgreSQL**: Version 9.3 is recommended. The minimum supported version
     is 9.1.
-  * **Linux**: Evergreen 2.10.7 has been tested on Debian Jessie (8.0),
+  * **Linux**: Evergreen 2.10.8 has been tested on Debian Jessie (8.0),
     Debian Wheezy (7.0), Ubuntu Trusty Tahr (14.04),
     Ubuntu Precise Pangolin (12.04), and Fedora.
     If you are running an older version of these distributions, you may want
@@ -44,12 +44,12 @@ osrf_control --localhost --stop-all
  .. Back up the /openils directory.
 . Upgrade OpenSRF. Download and install the latest version of OpenSRF from
 the https://evergreen-ils.org/opensrf-downloads/[OpenSRF download page].
-. As the *opensrf* user, download and extract Evergreen 2.10.7:
+. As the *opensrf* user, download and extract Evergreen 2.10.8:
 +
 [source, bash]
 -----------------------------------------------
-wget https://evergreen-ils.org/downloads/Evergreen-ILS-2.10.7.tar.gz
-tar xzf Evergreen-ILS-2.10.7.tar.gz
+wget https://evergreen-ils.org/downloads/Evergreen-ILS-2.10.8.tar.gz
+tar xzf Evergreen-ILS-2.10.8.tar.gz
 -----------------------------------------------
 +
 [NOTE]
@@ -59,7 +59,7 @@ For the latest edition of Evergreen, check the https://evergreen-ils.org/egdownl
 +
 [source, bash]
 ---------------------------------------------
-cd /home/opensrf/Evergreen-ILS-2.10.7
+cd /home/opensrf/Evergreen-ILS-2.10.8
 ---------------------------------------------
 +
 On the next command, replace `[distribution]` with one of these values for your
@@ -84,7 +84,7 @@ make -f Open-ILS/src/extras/Makefile.install [distribution]
 +
 [source, bash]
 ------------------------------------------------------------
-cd /home/opensrf/Evergreen-ILS-2.10.7
+cd /home/opensrf/Evergreen-ILS-2.10.8
 PATH=/openils/bin:$PATH ./configure --prefix=/openils --sysconfdir=/openils/conf
 make
 ------------------------------------------------------------
@@ -95,8 +95,8 @@ These instructions assume that you have also installed OpenSRF under /openils/.
 +
 [source, bash]
 ------------------------------------------------------------
-cd /home/opensrf/Evergreen-ILS-2.10.7
-make STAFF_CLIENT_STAMP_ID=rel_2_10_7 install
+cd /home/opensrf/Evergreen-ILS-2.10.8
+make STAFF_CLIENT_STAMP_ID=rel_2_10_8 install
 ------------------------------------------------------------
 +
 . As the *root* user, change all files to be owned by the opensrf user and group:
@@ -112,7 +112,7 @@ chown -R opensrf:opensrf /openils
 -----------------------------------------------------------
 cd /openils/var/web/xul/
 rm server
-ln -sf rel_2_10_7/server server
+ln -sf rel_2_10_8/server server
 ----------------------------------------------------------
 +
 . As the *opensrf* user, update opensrf_core.xml and opensrf.xml by copying the
@@ -132,7 +132,7 @@ Copying these configuration files will remove any customizations you have made t
 +
 [source, bash]
 -------------------------------------------------------------------------
-cd /home/opensrf/Evergreen-ILS-2.10.7
+cd /home/opensrf/Evergreen-ILS-2.10.8
 perl Open-ILS/src/support-scripts/eg_db_config --update-config --service all \
 --create-offline --database evergreen --host localhost --user evergreen --password evergreen
 -------------------------------------------------------------------------
@@ -156,21 +156,21 @@ The diff command can be used to show the differences between the distribution ve
 +
 [source, bash]
 ----------------------------------------------------------
-cp /home/opensrf/Evergreen-ILS-2.10.7/Open-ILS/examples/apache/eg_startup /etc/apache2/eg_startup
+cp /home/opensrf/Evergreen-ILS-2.10.8/Open-ILS/examples/apache/eg_startup /etc/apache2/eg_startup
 ----------------------------------------------------------
 +
 .. Update /etc/apache2/eg_vhost.conf by copying the example from Open-ILS/examples/apache/eg_vhost.conf.
 +
 [source, bash]
 ----------------------------------------------------------
-cp /home/opensrf/Evergreen-ILS-2.10.7/Open-ILS/examples/apache/eg_vhost.conf /etc/apache2/eg_vhost.conf
+cp /home/opensrf/Evergreen-ILS-2.10.8/Open-ILS/examples/apache/eg_vhost.conf /etc/apache2/eg_vhost.conf
 ----------------------------------------------------------
 +
 .. Update /etc/apache2/sites-available/eg.conf by copying the example from Open-ILS/examples/apache/eg.conf.
 +
 [source, bash]
 ----------------------------------------------------------
-cp /home/opensrf/Evergreen-ILS-2.10.7/Open-ILS/examples/apache/eg.conf /etc/apache2/sites-available/eg.conf
+cp /home/opensrf/Evergreen-ILS-2.10.8/Open-ILS/examples/apache/eg.conf /etc/apache2/sites-available/eg.conf
 ----------------------------------------------------------
 
 Upgrade the Evergreen database schema
@@ -193,7 +193,7 @@ anything goes wrong during the upgrade.
 =============
 Evergreen provides incremental upgrade scripts that allow you to upgrade
 from one minor version to the next until you have the current version of
-the schema. For example, if you want to upgrade from 2.5.1 to 2.10.7, you
+the schema. For example, if you want to upgrade from 2.5.1 to 2.10.8, you
 would run the following upgrade scripts:
 
 - 2.5.1-2.5.2-upgrade-db.sql
@@ -222,13 +222,14 @@ would run the following upgrade scripts:
 - 2.10.4-2.10.5-upgrade-db.sql
 - 2.10.5-2.10.6-upgrade-db.sql
 - 2.10.6-2.10.7-upgrade-db.sql
+- 2.10.7-2.10.8-upgrade-db.sql
 
 Note that you do *not* want to run additional 2.5 scripts to upgrade to the
 newest version of 2.5, since currently there is no automated way to upgrade
 from 2.5.4+ to 2.6. Only upgrade as far as necessary to reach the major
 version upgrade script (in this example, as far as 2.5.3).
 
-To upgrade across multiple major versions (e.g. from 2.3.0 to 2.10.7), use
+To upgrade across multiple major versions (e.g. from 2.3.0 to 2.10.8), use
 the same logic to utilize the provided major version upgrade scripts. For
 example:
 
@@ -246,7 +247,7 @@ example:
 - 2.8.4-2.9.0-upgrade-db.sql
 - (run all incremental scripts from 2.9.0 to 2.9.3)
 - 2.9.3-2.10.0-upgrade-db.sql
-- (run all incremental scripts from 2.10.0 to 2.10.7)
+- (run all incremental scripts from 2.10.0 to 2.10.8)
 =============
 
 [CAUTION]
@@ -260,8 +261,8 @@ as a user with the ability to connect to the database server.
 
 [source, bash]
 ----------------------------------------------------------
-cd /home/opensrf/Evergreen-ILS-2.10.7/Open-ILS/src/sql/Pg
-psql -U evergreen -h localhost -f version-upgrade/2.10.6-2.10.7-upgrade-db.sql evergreen
+cd /home/opensrf/Evergreen-ILS-2.10.8/Open-ILS/src/sql/Pg
+psql -U evergreen -h localhost -f version-upgrade/2.10.6-2.10.8-upgrade-db.sql evergreen
 ----------------------------------------------------------
 
 [TIP]

commit be89bb3c899f1690da167417224d0de06013576e
Author: Galen Charlton <gmc at esilibrary.com>
Date:   Wed Nov 16 15:18:28 2016 -0500

    2.10.7-2.10.8 schema upgrade script
    
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/Open-ILS/src/sql/Pg/version-upgrade/2.10.7-2.10.8-upgrade-db.sql b/Open-ILS/src/sql/Pg/version-upgrade/2.10.7-2.10.8-upgrade-db.sql
new file mode 100644
index 0000000..437fbc5
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/version-upgrade/2.10.7-2.10.8-upgrade-db.sql
@@ -0,0 +1,109 @@
+--Upgrade Script for 2.10.7 to 2.10.8
+\set eg_version '''2.10.8'''
+BEGIN;
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('2.10.8', :eg_version);
+
+SELECT evergreen.upgrade_deps_block_check('1001', :eg_version); -- stompro/gmcharlt
+
+CREATE INDEX action_usr_circ_history_usr_idx ON action.usr_circ_history ( usr );
+
+-- Add Spanish to config.i18n_locale table
+SELECT evergreen.upgrade_deps_block_check('1002', :eg_version);
+
+INSERT INTO config.i18n_locale (code,marc_code,name,description)
+    SELECT 'es-ES', 'spa', oils_i18n_gettext('es-ES', 'Spanish', 'i18n_l', 'name'),
+        oils_i18n_gettext('es-ES', 'Spanish', 'i18n_l', 'description')
+    WHERE NOT EXISTS (SELECT 1 FROM config.i18n_locale WHERE code = 'es-ES');
+
+SELECT evergreen.upgrade_deps_block_check('1003', :eg_version); -- gmcharlt/rhamby/csharp
+
+CREATE OR REPLACE FUNCTION metabib.remap_metarecord_for_bib( bib_id BIGINT, fp TEXT, bib_is_deleted BOOL DEFAULT FALSE, retain_deleted BOOL DEFAULT FALSE ) RETURNS BIGINT AS $func$
+DECLARE
+    new_mapping     BOOL := TRUE;
+    source_count    INT;
+    old_mr          BIGINT;
+    tmp_mr          metabib.metarecord%ROWTYPE;
+    deleted_mrs     BIGINT[];
+BEGIN
+
+    -- We need to make sure we're not a deleted master record of an MR
+    IF bib_is_deleted THEN
+        FOR old_mr IN SELECT id FROM metabib.metarecord WHERE master_record = bib_id LOOP
+
+            IF NOT retain_deleted THEN -- Go away for any MR that we're master of, unless retained
+                DELETE FROM metabib.metarecord_source_map WHERE source = bib_id;
+            END IF;
+
+            -- Now, are there any more sources on this MR?
+            SELECT COUNT(*) INTO source_count FROM metabib.metarecord_source_map WHERE metarecord = old_mr;
+
+            IF source_count = 0 AND NOT retain_deleted THEN -- No other records
+                deleted_mrs := ARRAY_APPEND(deleted_mrs, old_mr); -- Just in case...
+                DELETE FROM metabib.metarecord WHERE id = old_mr;
+
+            ELSE -- indeed there are. Update it with a null cache and recalcualated master record
+                UPDATE  metabib.metarecord
+                  SET   mods = NULL,
+                        master_record = ( SELECT id FROM biblio.record_entry WHERE fingerprint = fp AND NOT deleted ORDER BY quality DESC LIMIT 1)
+                  WHERE id = old_mr;
+            END IF;
+        END LOOP;
+
+    ELSE -- insert or update
+
+        FOR tmp_mr IN SELECT m.* FROM metabib.metarecord m JOIN metabib.metarecord_source_map s ON (s.metarecord = m.id) WHERE s.source = bib_id LOOP
+
+            -- Find the first fingerprint-matching
+            IF old_mr IS NULL AND fp = tmp_mr.fingerprint THEN
+                old_mr := tmp_mr.id;
+                new_mapping := FALSE;
+
+            ELSE -- Our fingerprint changed ... maybe remove the old MR
+                DELETE FROM metabib.metarecord_source_map WHERE metarecord = tmp_mr.id AND source = bib_id; -- remove the old source mapping
+                SELECT COUNT(*) INTO source_count FROM metabib.metarecord_source_map WHERE metarecord = tmp_mr.id;
+                IF source_count = 0 THEN -- No other records
+                    deleted_mrs := ARRAY_APPEND(deleted_mrs, tmp_mr.id);
+                    DELETE FROM metabib.metarecord WHERE id = tmp_mr.id;
+                END IF;
+            END IF;
+
+        END LOOP;
+
+        -- we found no suitable, preexisting MR based on old source maps
+        IF old_mr IS NULL THEN
+            SELECT id INTO old_mr FROM metabib.metarecord WHERE fingerprint = fp; -- is there one for our current fingerprint?
+
+            IF old_mr IS NULL THEN -- nope, create one and grab its id
+                INSERT INTO metabib.metarecord ( fingerprint, master_record ) VALUES ( fp, bib_id );
+                SELECT id INTO old_mr FROM metabib.metarecord WHERE fingerprint = fp;
+
+            ELSE -- indeed there is. update it with a null cache and recalcualated master record
+                UPDATE  metabib.metarecord
+                  SET   mods = NULL,
+                        master_record = ( SELECT id FROM biblio.record_entry WHERE fingerprint = fp AND NOT deleted ORDER BY quality DESC LIMIT 1)
+                  WHERE id = old_mr;
+            END IF;
+
+        ELSE -- there was one we already attached to, update its mods cache and master_record
+            UPDATE  metabib.metarecord
+              SET   mods = NULL,
+                    master_record = ( SELECT id FROM biblio.record_entry WHERE fingerprint = fp AND NOT deleted ORDER BY quality DESC LIMIT 1)
+              WHERE id = old_mr;
+        END IF;
+
+        IF new_mapping THEN
+            INSERT INTO metabib.metarecord_source_map (metarecord, source) VALUES (old_mr, bib_id); -- new source mapping
+        END IF;
+
+    END IF;
+
+    IF ARRAY_UPPER(deleted_mrs,1) > 0 THEN
+        UPDATE action.hold_request SET target = old_mr WHERE target IN ( SELECT unnest(deleted_mrs) ) AND hold_type = 'M'; -- if we had to delete any MRs above, make sure their holds are moved
+    END IF;
+
+    RETURN old_mr;
+
+END;
+$func$ LANGUAGE PLPGSQL;
+
+COMMIT;

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

Summary of changes:
 .../2.10.7-2.10.8-upgrade-db.sql}                  |   15 ++++++++
 docs/installation/server_upgrade.txt               |   37 ++++++++++---------
 2 files changed, 34 insertions(+), 18 deletions(-)
 copy Open-ILS/src/sql/Pg/{upgrade/1003.schema.fix_metarecord_remapping.sql => version-upgrade/2.10.7-2.10.8-upgrade-db.sql} (85%)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list