6 echo "USAGE: $0 <evergreen postgresql password>"
10 if [ -z "$pg_passwd" ]; then
14 EG_SOURCE_DIR="/home/gpls/pines"
16 3.6.1-3.6.2-upgrade-db.sql
17 3.6.2-3.7.0-upgrade-db.sql
18 3.7.0-3.7.1-upgrade-db.sql
19 3.7.1-3.8.0-upgrade-db.sql
20 student_card_updates.sql
21 pines_additional_sql_upgrade.sql"
23 for script in $SCRIPTS; do
24 echo "Now running $script at `date`"
25 time psql -U evergreen -f $EG_SOURCE_DIR/Open-ILS/src/sql/Pg/version-upgrade/$script
28 echo "Beginning vacuum at `date`"
29 PGUSER=evergreen vacuumdb --analyze
30 echo "Vacuum completed at `date`"
32 cd /var/lib/postgresql
33 for i in title author subject series identifier keyword; do
34 echo "symspell: Creating $i file at `date`."
35 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)"
36 echo "symspell: creating $i.sql file ad `date`."
37 $EG_SOURCE_DIR/Open-ILS/src/support-scripts/symspell-sideload.pl $i > $i.sql
40 psql -U evergreen -c "ALTER TABLE search.symspell_dictionary SET UNLOGGED"
41 psql -U evergreen -c "TRUNCATE search.symspell_dictionary"
43 for i in title author subject series identifier keyword; do
44 echo "inserting $i.sql at `date`"
45 psql -U evergreen -f $i.sql
48 psql -U evergreen -c "CLUSTER search.symspell_dictionary USING symspell_dictionary_pkey"
49 psql -U evergreen -c "REINDEX TABLE search.symspell_dictionary"
50 psql -U evergreen -c "ALTER TABLE search.symspell_dictionary SET LOGGED"
51 PGUSER=evergreen vacuumdb --analyze --table search.symspell_dictionary
53 for i in title author subject series identifier keyword; do
54 echo "symspell: dropping search.symspell_dictionary_partial_$i table at `date`"
55 psql -U evergreen -c "DROP TABLE search.symspell_dictionary_partial_$i"
58 echo "Beginning parallel regingest at `date`"
59 # disable triggers to prevent deadlocks - see https://bugs.launchpad.net/evergreen/+bug/1931737
60 psql -U evergreen -c "ALTER TABLE metabib.title_field_entry DISABLE TRIGGER maintain_symspell_entries_tgr"
61 psql -U evergreen -c "ALTER TABLE metabib.author_field_entry DISABLE TRIGGER maintain_symspell_entries_tgr"
62 psql -U evergreen -c "ALTER TABLE metabib.subject_field_entry DISABLE TRIGGER maintain_symspell_entries_tgr"
63 psql -U evergreen -c "ALTER TABLE metabib.series_field_entry DISABLE TRIGGER maintain_symspell_entries_tgr"
64 psql -U evergreen -c "ALTER TABLE metabib.keyword_field_entry DISABLE TRIGGER maintain_symspell_entries_tgr"
65 psql -U evergreen -c "ALTER TABLE metabib.identifier_field_entry DISABLE TRIGGER maintain_symspell_entries_tgr"
66 time PGUSER=evergreen PGPASSWORD="$pg_passwd" $EG_SOURCE_DIR/Open-ILS/src/support-scripts/pingest.pl --batch-size 10000 --max-child 8 --skip-browse
67 psql -U evergreen -c "ALTER TABLE metabib.title_field_entry ENABLE TRIGGER maintain_symspell_entries_tgr"
68 psql -U evergreen -c "ALTER TABLE metabib.author_field_entry ENABLE TRIGGER maintain_symspell_entries_tgr"
69 psql -U evergreen -c "ALTER TABLE metabib.subject_field_entry ENABLE TRIGGER maintain_symspell_entries_tgr"
70 psql -U evergreen -c "ALTER TABLE metabib.series_field_entry ENABLE TRIGGER maintain_symspell_entries_tgr"
71 psql -U evergreen -c "ALTER TABLE metabib.keyword_field_entry ENABLE TRIGGER maintain_symspell_entries_tgr"
72 psql -U evergreen -c "ALTER TABLE metabib.identifier_field_entry ENABLE TRIGGER maintain_symspell_entries_tgr"
74 echo "Finished PINES 3.8.0 upgrade at `date`."