From d6c2c2215501398895717419bd399a8113075671 Mon Sep 17 00:00:00 2001 From: Chris Sharp Date: Wed, 10 Nov 2021 13:33:49 -0500 Subject: [PATCH] remove post upgrade script; add script to do it all --- .../Pg/version-upgrade/pines-post-3.8-upgrade.sql | 8 ---- .../sql/Pg/version-upgrade/run_pines_upgrade.sh | 48 ++++++++++++++++++++++ 2 files changed, 48 insertions(+), 8 deletions(-) delete mode 100644 Open-ILS/src/sql/Pg/version-upgrade/pines-post-3.8-upgrade.sql create mode 100755 Open-ILS/src/sql/Pg/version-upgrade/run_pines_upgrade.sh diff --git a/Open-ILS/src/sql/Pg/version-upgrade/pines-post-3.8-upgrade.sql b/Open-ILS/src/sql/Pg/version-upgrade/pines-post-3.8-upgrade.sql deleted file mode 100644 index 7807ddde3d..0000000000 --- a/Open-ILS/src/sql/Pg/version-upgrade/pines-post-3.8-upgrade.sql +++ /dev/null @@ -1,8 +0,0 @@ --- reingest -SELECT COUNT(metabib.reingest_record_attributes(bre.id)) - FROM biblio.record_entry bre - JOIN metabib.record_attr_flat mraf ON (bre.id = mraf.id) - WHERE deleted IS FALSE - AND attr = 'item_type' - AND value = 'g'; - diff --git a/Open-ILS/src/sql/Pg/version-upgrade/run_pines_upgrade.sh b/Open-ILS/src/sql/Pg/version-upgrade/run_pines_upgrade.sh new file mode 100755 index 0000000000..7e6c411f76 --- /dev/null +++ b/Open-ILS/src/sql/Pg/version-upgrade/run_pines_upgrade.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +SCRIPTS=" +3.6.1-3.6.2-upgrade-db.sql +3.6.2-3.7.0-upgrade-db.sql +3.6.3-3.6.4-upgrade-db.sql +3.7.0-3.7.1-upgrade-db.sql +3.7.1-3.8.0-upgrade-db.sql" + +for script in $SCRIPTS; do + echo "Now running $script at `date`" + time psql -U evergreen -f /home/gpls/pines/Open-ILS/src/sql/Pg/version-upgrade/$script +done + +echo "Beginning vacuum at `date`" +PGUSER=evergreen vacuumdb --analyze +echo "Vacuum completed at `date`" + +cd /var/lib/postgresql +for i in title author subject series identifier keyword; do + echo "symspell: Creating $i file at `date`." + psql -U evergreen -A -t -o $i -c "select value from metabib.${i}_field_entry where source in (select id from biblio.record_entry where not deleted)" + echo "symspell: creating $i.sql file ad `date`." + /home/gpls/pines/Open-ILS/src/support-scripts/symspell-sideload.pl $i > $i.sql +done + +psql -U evergreen -c "ALTER TABLE search.symspell_dictionary SET UNLOGGED" +psql -U evergreen -c "TRUNCATE search.symspell_dictionary" + +for i in title author subject series identifier keyword; do + echo "inserting $i.sql at `date`" + psql -U evergreen -f $i.sql +done + +psql -U evergreen -c "CLUSTER search.symspell_dictionary USING symspell_dictionary_pkey" +psql -U evergreen -c "REINDEX TABLE search.symspell_dictionary" +psql -U evergreen -c "ALTER TABLE search.symspell_dictionary SET LOGGED" +PGUSER=evergreen vacuumdb --analyze --table search.symspell_dictionary + +for i in title author subject series identifier keyword; do + echo "symspell: dropping search.symspell_dictionary_partial_$i table at `date`" + psql -U evergreen -c "DROP TABLE search.symspell_dictionary_partial_$i" +done + +echo "Beginning parallel regingest at `date`" +# time PGUSER=evergreen PGPASSWORD="youwish" pines/Open-ILS/src/support-scripts/pingest.pl --batch-size 10000 --max-child 8 --skip-browse + +echo "Finished PINES 3.8.0 upgrade at `date`." -- 2.11.0