[open-ils-commits] [GIT] Evergreen ILS branch master updated. 5fc427c9508855ea755d100b5773f500376d9fe3

Evergreen Git git at git.evergreen-ils.org
Wed Sep 20 17:44:10 EDT 2017


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  5fc427c9508855ea755d100b5773f500376d9fe3 (commit)
       via  06cd847182d46a139f508b93248745e298c36644 (commit)
       via  3eaf2e54810c53ba61ac9f5af32e3cae30062702 (commit)
      from  3edbdfcc1e834c74801ae7021592dbfd418ffafe (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 5fc427c9508855ea755d100b5773f500376d9fe3
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date:   Wed Sep 20 11:48:39 2017 -0400

    LP#1715503: make eg_db_config refuse to create DB if min Pg version not met
    
    This patch ensures that eg_db_config --create-database will abort if
    the Pg version is not at least 9.4. It also tweaks the version check
    to (in principle) work for Pg 10.
    
    This patch also removes some stuff related to support Pg versions
    less than 9.4, most notably using contribs rather than extensions.
    
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/sql/Pg/000.english.pg91.fts-config.sql b/Open-ILS/src/sql/Pg/000.english.pg91.fts-config.sql
deleted file mode 100644
index 8bae23e..0000000
--- a/Open-ILS/src/sql/Pg/000.english.pg91.fts-config.sql
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2004-2008  Georgia Public Library Service
- * Copyright (C) 2008  Equinox Software, Inc., Laurentian University
- * Mike Rylander <miker at esilibrary.com>
- * Dan Scott <dscott at laurentian.ca>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-BEGIN;
-
-SET search_path = public, pg_catalog;
-
-CREATE OR REPLACE FUNCTION oils_tsearch2 () RETURNS TRIGGER AS $$
-BEGIN
-	NEW.index_vector = to_tsvector((TG_ARGV[0])::regconfig, NEW.value);
-	RETURN NEW;
-END;
-$$ LANGUAGE PLPGSQL;
-
-DO $$
-DECLARE
-lang TEXT;
-BEGIN
-FOR lang IN SELECT substring(pptsd.dictname from '(.*)_stem$') AS lang FROM pg_catalog.pg_ts_dict pptsd JOIN pg_catalog.pg_namespace ppn ON ppn.oid = pptsd.dictnamespace
-WHERE ppn.nspname = 'pg_catalog' AND pptsd.dictname LIKE '%_stem' LOOP
-RAISE NOTICE 'FOUND LANGUAGE %', lang;
-
-EXECUTE 'DROP TEXT SEARCH DICTIONARY IF EXISTS ' || lang || '_nostop CASCADE;
-CREATE TEXT SEARCH DICTIONARY ' || lang || '_nostop (TEMPLATE=pg_catalog.snowball, language=''' || lang || ''');
-COMMENT ON TEXT SEARCH DICTIONARY ' || lang || '_nostop IS ''' ||lang || ' snowball stemmer with no stopwords for ASCII words only.'';
-CREATE TEXT SEARCH CONFIGURATION ' || lang || '_nostop ( COPY = pg_catalog.' || lang || ' );
-ALTER TEXT SEARCH CONFIGURATION ' || lang || '_nostop ALTER MAPPING FOR word, hword, hword_part WITH pg_catalog.simple;
-ALTER TEXT SEARCH CONFIGURATION ' || lang || '_nostop ALTER MAPPING FOR asciiword, asciihword, hword_asciipart WITH ' || lang || '_nostop;';
-
-END LOOP;
-END;
-$$;
-CREATE TEXT SEARCH CONFIGURATION title ( COPY = english_nostop );
-CREATE TEXT SEARCH CONFIGURATION author ( COPY = english_nostop );
-CREATE TEXT SEARCH CONFIGURATION subject ( COPY = english_nostop );
-CREATE TEXT SEARCH CONFIGURATION keyword ( COPY = english_nostop );
-CREATE TEXT SEARCH CONFIGURATION identifier ( COPY = english_nostop );
-CREATE TEXT SEARCH CONFIGURATION series ( COPY = english_nostop );
-CREATE TEXT SEARCH CONFIGURATION "default" ( COPY = english_nostop );
-
-
-COMMIT;
diff --git a/Open-ILS/src/sql/Pg/000.english.pg92.fts-config.sql b/Open-ILS/src/sql/Pg/000.english.pg92.fts-config.sql
deleted file mode 120000
index 0b24fd9..0000000
--- a/Open-ILS/src/sql/Pg/000.english.pg92.fts-config.sql
+++ /dev/null
@@ -1 +0,0 @@
-000.english.pg91.fts-config.sql
\ No newline at end of file
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
deleted file mode 120000
index 0b24fd9..0000000
--- a/Open-ILS/src/sql/Pg/000.english.pg93.fts-config.sql
+++ /dev/null
@@ -1 +0,0 @@
-000.english.pg91.fts-config.sql
\ No newline at end of file
diff --git a/Open-ILS/src/sql/Pg/000.english.pg94.fts-config.sql b/Open-ILS/src/sql/Pg/000.english.pg94.fts-config.sql
deleted file mode 120000
index 0b24fd9..0000000
--- a/Open-ILS/src/sql/Pg/000.english.pg94.fts-config.sql
+++ /dev/null
@@ -1 +0,0 @@
-000.english.pg91.fts-config.sql
\ No newline at end of file
diff --git a/Open-ILS/src/sql/Pg/000.english.pg94.fts-config.sql b/Open-ILS/src/sql/Pg/000.english.pg94.fts-config.sql
new file mode 100644
index 0000000..8bae23e
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/000.english.pg94.fts-config.sql
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2004-2008  Georgia Public Library Service
+ * Copyright (C) 2008  Equinox Software, Inc., Laurentian University
+ * Mike Rylander <miker at esilibrary.com>
+ * Dan Scott <dscott at laurentian.ca>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+BEGIN;
+
+SET search_path = public, pg_catalog;
+
+CREATE OR REPLACE FUNCTION oils_tsearch2 () RETURNS TRIGGER AS $$
+BEGIN
+	NEW.index_vector = to_tsvector((TG_ARGV[0])::regconfig, NEW.value);
+	RETURN NEW;
+END;
+$$ LANGUAGE PLPGSQL;
+
+DO $$
+DECLARE
+lang TEXT;
+BEGIN
+FOR lang IN SELECT substring(pptsd.dictname from '(.*)_stem$') AS lang FROM pg_catalog.pg_ts_dict pptsd JOIN pg_catalog.pg_namespace ppn ON ppn.oid = pptsd.dictnamespace
+WHERE ppn.nspname = 'pg_catalog' AND pptsd.dictname LIKE '%_stem' LOOP
+RAISE NOTICE 'FOUND LANGUAGE %', lang;
+
+EXECUTE 'DROP TEXT SEARCH DICTIONARY IF EXISTS ' || lang || '_nostop CASCADE;
+CREATE TEXT SEARCH DICTIONARY ' || lang || '_nostop (TEMPLATE=pg_catalog.snowball, language=''' || lang || ''');
+COMMENT ON TEXT SEARCH DICTIONARY ' || lang || '_nostop IS ''' ||lang || ' snowball stemmer with no stopwords for ASCII words only.'';
+CREATE TEXT SEARCH CONFIGURATION ' || lang || '_nostop ( COPY = pg_catalog.' || lang || ' );
+ALTER TEXT SEARCH CONFIGURATION ' || lang || '_nostop ALTER MAPPING FOR word, hword, hword_part WITH pg_catalog.simple;
+ALTER TEXT SEARCH CONFIGURATION ' || lang || '_nostop ALTER MAPPING FOR asciiword, asciihword, hword_asciipart WITH ' || lang || '_nostop;';
+
+END LOOP;
+END;
+$$;
+CREATE TEXT SEARCH CONFIGURATION title ( COPY = english_nostop );
+CREATE TEXT SEARCH CONFIGURATION author ( COPY = english_nostop );
+CREATE TEXT SEARCH CONFIGURATION subject ( COPY = english_nostop );
+CREATE TEXT SEARCH CONFIGURATION keyword ( COPY = english_nostop );
+CREATE TEXT SEARCH CONFIGURATION identifier ( COPY = english_nostop );
+CREATE TEXT SEARCH CONFIGURATION series ( COPY = english_nostop );
+CREATE TEXT SEARCH CONFIGURATION "default" ( COPY = english_nostop );
+
+
+COMMIT;
diff --git a/Open-ILS/src/sql/Pg/000.english.pg95.fts-config.sql b/Open-ILS/src/sql/Pg/000.english.pg95.fts-config.sql
index 0b24fd9..38504b5 120000
--- a/Open-ILS/src/sql/Pg/000.english.pg95.fts-config.sql
+++ b/Open-ILS/src/sql/Pg/000.english.pg95.fts-config.sql
@@ -1 +1 @@
-000.english.pg91.fts-config.sql
\ No newline at end of file
+000.english.pg94.fts-config.sql
\ No newline at end of file
diff --git a/Open-ILS/src/sql/Pg/000.english.pg96.fts-config.sql b/Open-ILS/src/sql/Pg/000.english.pg96.fts-config.sql
index 0b24fd9..38504b5 120000
--- a/Open-ILS/src/sql/Pg/000.english.pg96.fts-config.sql
+++ b/Open-ILS/src/sql/Pg/000.english.pg96.fts-config.sql
@@ -1 +1 @@
-000.english.pg91.fts-config.sql
\ No newline at end of file
+000.english.pg94.fts-config.sql
\ No newline at end of file
diff --git a/Open-ILS/src/sql/Pg/create_database_contribs.sql b/Open-ILS/src/sql/Pg/create_database_contribs.sql
deleted file mode 100644
index a2fd1c8..0000000
--- a/Open-ILS/src/sql/Pg/create_database_contribs.sql
+++ /dev/null
@@ -1,26 +0,0 @@
--- This file is intended to be called by eg_db_config.pl
-
--- If manually calling:
--- Connect to the postgres database initially
--- Specify the database to create as -vdb_name=DATABASE
--- Specify the postgres contrib directory as -vcontrib_dir=CONTRIBDIR
--- You can get the contrib directory using pg_config --sharedir and adding a /contrib to it
-
--- NOTE: This file does not do transactions
--- This is intentional. Please do not wrap in BEGIN/COMMIT.
-DROP DATABASE IF EXISTS :db_name;
-
-CREATE DATABASE :db_name TEMPLATE template0 ENCODING 'UNICODE' LC_COLLATE 'C' LC_CTYPE 'C';
-
-\connect :db_name
-
---CREATE LANGUAGE plperl;
-CREATE LANGUAGE plperlu;
-
--- This dance is because :variable/blah doesn't seem to work when doing \i
--- But it does when doing \set
--- So we \set to a single variable, then use that single variable with \i
-\set load_file :contrib_dir/pgxml.sql
-\i :load_file
-\set load_file :contrib_dir/hstore.sql
-\i :load_file
diff --git a/Open-ILS/src/support-scripts/eg_db_config.in b/Open-ILS/src/support-scripts/eg_db_config.in
index a08dda9..dc61d09 100755
--- a/Open-ILS/src/support-scripts/eg_db_config.in
+++ b/Open-ILS/src/support-scripts/eg_db_config.in
@@ -32,8 +32,6 @@ my $build_db_sh = '';
 my $offline_file = '';
 my $prefix = '';
 my $sysconfdir = '';
-my $pg_contribdir = '';
-my $create_db_sql_contribs = '';
 my $create_db_sql_extensions = '';
 my @services;
 
@@ -135,7 +133,7 @@ sub get_settings {
 	$settings->{pw} = $settings->{pw} || $opensrf_config->findnodes($pw);
 }
 
-=item create_database() - Creates the database using create_database_contribs.sql
+=item create_database() - Creates the database using create_database_extensions.sql
 =cut
 sub create_database {
 	my $settings = shift;
@@ -144,18 +142,21 @@ sub create_database {
 	$ENV{'PGPASSWORD'} = $settings->{pw};
 	$ENV{'PGPORT'} = $settings->{port};
 	$ENV{'PGHOST'} = $settings->{host};
-	my @temp = `psql -d postgres -qtc 'show server_version;' | xargs | cut -c1,3`;
+	my @temp = `psql -d postgres -qtc 'show server_version;' | xargs | cut -d. -f 1,2 | tr -d '.'`;
 	chomp $temp[0];
 	my $pgversion = $temp[0];
 	my $cmd;
-	# If it looks like it is 9.1 or greater, use create_database_extensions.sql
-	# Otherwise use create_database_contribs.sql
-	if($pgversion >= '91') {
-		$cmd = 'psql -vdb_name=' . $settings->{db} . ' -d postgres -f ' . $create_db_sql_extensions;
-	} else {
-		$cmd = 'psql -vdb_name=' . $settings->{db} . ' -vcontrib_dir=' . $pg_contribdir .
-			' -d postgres -f ' . $create_db_sql_contribs;
+	unless ($pgversion >= '94') {
+        my @message = ();
+		push(@message,
+			"\n------------------------------------------------------------------------------\n",
+			"Cannot create database; version of PostgreSQL appears to be less than the\n",
+			"minimum required of 9.4\n",
+			"------------------------------------------------------------------------------\n",
+		);
+		die(@message);
 	}
+	$cmd = 'psql -vdb_name=' . $settings->{db} . ' -d postgres -f ' . $create_db_sql_extensions;
 	my @output = `$cmd 2>&1`;
 	if(grep(/(ERROR|No such file or directory)/, at output)) {
 		push(@output, "\n------------------------------------------------------------------------------\n",
@@ -267,8 +268,6 @@ GetOptions("create-schema" => \$cschema,
 		"update-config" => \$uconfig,
 		"config-file=s" => \$config_file,
 		"build-db-file=s" => \$build_db_sh,
-		"pg-contrib-dir=s" => \$pg_contribdir,
-		"create-db-sql-contribs=s" => \$create_db_sql_contribs,
 		"create-db-sql-extensions=s" => \$create_db_sql_extensions,
 		"pg-config=s" => \$pgconfig,
 		"admin-user=s" => \$admin_user,
@@ -305,17 +304,6 @@ if (!$build_db_sh) {
 	$build_db_sh = File::Spec->catfile($script_dir, '../sql/Pg/build-db.sh');
 }
 
-if (!$pg_contribdir) {
-	$pgconfig = 'pg_config' if(!$pgconfig);
-	my @temp = `$pgconfig --sharedir`;
-	chomp $temp[0];
-	$pg_contribdir = File::Spec->catdir($temp[0], 'contrib');
-}
-
-if (!$create_db_sql_contribs) {
-	$create_db_sql_contribs = File::Spec->catfile($script_dir, '../sql/Pg/create_database_contribs.sql');
-}
-
 if (!$create_db_sql_extensions) {
 	$create_db_sql_extensions = File::Spec->catfile($script_dir, '../sql/Pg/create_database_extensions.sql');
 }

commit 06cd847182d46a139f508b93248745e298c36644
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date:   Wed Sep 20 11:23:29 2017 -0400

    LP#1715503: make upgrade script abort if not running min support version
    
    This patch causes the monolithic upgrade script to fail if the
    database its connecting to isn't running at least Pg 9.4.
    
    To test
    -------
    [1] Verify that 2.12.5-3.0-beta1-upgrade-db.sql will abort
        if used in a Pg database < 9.4; verify that it will work
        if the Pg version is at least 9.4
    
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql b/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql
index d10e316..e8e585b 100644
--- a/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql
+++ b/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql
@@ -1,5 +1,23 @@
 --Upgrade Script for 2.12.5 to 3.0-beta1
 \set eg_version '''3.0-beta1'''
+
+-- verify that we're running a recent enough version of Pg
+\set ON_ERROR_STOP on
+BEGIN;
+
+DO $$
+   DECLARE ver INTEGER;
+   BEGIN
+      SELECT current_setting('server_version_num') INTO ver;
+      IF (ver < 90400) THEN
+         RAISE EXCEPTION 'Not running a new enough version of PostgreSQL. Minimum required is 9.4; you have %', ver;
+      END IF;
+   END;
+$$;
+
+COMMIT;
+\set ON_ERROR_STOP off
+
 BEGIN;
 INSERT INTO config.upgrade_log (version, applied_to) VALUES ('3.0-beta1', :eg_version);
 

commit 3eaf2e54810c53ba61ac9f5af32e3cae30062702
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date:   Wed Sep 20 11:11:08 2017 -0400

    LP#1715503: update install & upgrade doc to require Pg 9.4
    
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/docs/installation/server_installation.adoc b/docs/installation/server_installation.adoc
index 5e7e2c8..d651c88 100644
--- a/docs/installation/server_installation.adoc
+++ b/docs/installation/server_installation.adoc
@@ -54,8 +54,7 @@ autoreconf -i
 Installing prerequisites
 ------------------------
 
-  * **PostgreSQL**: Version 9.4 is recommended. 
-    The minimum supported version is 9.3.
+  * **PostgreSQL**: The minimum supported version is 9.4.
   * **Linux**: Evergreen has been tested on Debian Stretch (9), 
     Debian Jessie (8), Debian Wheezy (7), Ubuntu Xenial Xerus (16.04), 
     and Ubuntu Trusty Tahr (14.04).
diff --git a/docs/installation/server_upgrade.adoc b/docs/installation/server_upgrade.adoc
index dac97d4..bd04115 100644
--- a/docs/installation/server_upgrade.adoc
+++ b/docs/installation/server_upgrade.adoc
@@ -6,8 +6,7 @@ All of the steps in this chapter are to be completed from the command line.
 Software Prerequisites
 ~~~~~~~~~~~~~~~~~~~~~~
 
-  * **PostgreSQL**: Version 9.4 is recommended.
-    The minimum supported version is 9.3.
+  * **PostgreSQL**: The minimum supported version is 9.4.
   * **Linux**: Evergreen 2.12.0 has been tested on Debian Stretch,
     Debian Jessie (8.0), Debian Wheezy (7.0), Ubuntu Xenial Xerus (16.04),
     and Ubuntu Trusty Tahr (14.04).

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

Summary of changes:
 .../src/sql/Pg/000.english.pg91.fts-config.sql     |   57 -------------------
 .../src/sql/Pg/000.english.pg92.fts-config.sql     |    1 -
 .../src/sql/Pg/000.english.pg93.fts-config.sql     |    1 -
 .../src/sql/Pg/000.english.pg94.fts-config.sql     |   58 +++++++++++++++++++-
 .../src/sql/Pg/000.english.pg95.fts-config.sql     |    2 +-
 .../src/sql/Pg/000.english.pg96.fts-config.sql     |    2 +-
 Open-ILS/src/sql/Pg/create_database_contribs.sql   |   26 ---------
 .../2.12.5-3.0-beta1-upgrade-db.sql                |   18 ++++++
 Open-ILS/src/support-scripts/eg_db_config.in       |   36 ++++--------
 docs/installation/server_installation.adoc         |    3 +-
 docs/installation/server_upgrade.adoc              |    3 +-
 11 files changed, 91 insertions(+), 116 deletions(-)
 delete mode 100644 Open-ILS/src/sql/Pg/000.english.pg91.fts-config.sql
 delete mode 120000 Open-ILS/src/sql/Pg/000.english.pg92.fts-config.sql
 delete mode 120000 Open-ILS/src/sql/Pg/000.english.pg93.fts-config.sql
 mode change 120000 => 100644 Open-ILS/src/sql/Pg/000.english.pg94.fts-config.sql
 delete mode 100644 Open-ILS/src/sql/Pg/create_database_contribs.sql


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list