[postgis-tickets] [SCM] PostGIS branch master updated. 3.1.0alpha2-98-g06fa4cf

git at osgeo.org git at osgeo.org
Tue Oct 27 14:26:36 PDT 2020


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 "PostGIS".

The branch, master has been updated
       via  06fa4cfd3991a33b5d1bda3bb7cc7888ffeb52b3 (commit)
      from  e7c3c7f2a5d46d27fa7a7a4b0886d263265e6b72 (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 06fa4cfd3991a33b5d1bda3bb7cc7888ffeb52b3
Author: Sandro Santilli <strk at kbt.io>
Date:   Tue Oct 27 22:26:04 2020 +0100

    Draft utility script to test pg_upgrade

diff --git a/utils/check_cluster_upgrade.sh b/utils/check_cluster_upgrade.sh
new file mode 100755
index 0000000..0450194
--- /dev/null
+++ b/utils/check_cluster_upgrade.sh
@@ -0,0 +1,109 @@
+#!/bin/sh
+
+TMPDIR=/tmp/pgis_upgrade_test-$$/
+DATADIR=${TMPDIR}/cluster
+LOGFILE=${TMPDIR}/log
+export PGPORT=15432
+export PGHOST=${TMPDIR}
+export PGDATABASE=pgis
+PG_CONFIG_OLD=
+PG_CONFIG_NEW=
+
+usage() {
+  echo "Usage: $0 <pg_config> <pg_config>"
+}
+
+cleanup() {
+  ${BIN_OLD}/pg_ctl -D ${DATADIR} stop || exit 1
+  rm -rf ${TMPDIR}
+}
+
+trap 'cleanup' EXIT
+
+mkdir -p ${TMPDIR}
+
+while test -n "$1"; do
+  if test -z "$PG_CONFIG_OLD"; then
+    PG_CONFIG_OLD="$1"
+    shift
+  elif test -z "$PG_CONFIG_NEW"; then
+    PG_CONFIG_NEW="$1"
+    shift
+  else
+    echo "Unrecognized argument: $1" >&2
+    usage >&2
+    exit 1
+  fi
+done
+
+if test -z "$PG_CONFIG_NEW"; then
+  echo "Missing new pg_config path" >&2
+  usage >&2
+  exit 1
+fi
+
+if test "$PG_CONFIG_OLD" = "$PG_CONFIG_NEW"; then
+  echo "Old and new pg_config paths need be different" >&2
+  exit 1
+fi
+
+BIN_OLD=$(${PG_CONFIG_OLD} --bindir)
+BIN_NEW=$(${PG_CONFIG_NEW} --bindir)
+
+echo "Testing cluster upgrade"
+echo "FROM: $(${PG_CONFIG_OLD} --version)"
+echo "  TO: $(${PG_CONFIG_NEW} --version)"
+
+echo "Creating FROM cluster"
+${BIN_OLD}/initdb ${DATADIR} > ${LOGFILE} 2>&1 || {
+  cat ${LOGFILE} && exit 1
+}
+
+echo "Starting FROM cluster"
+${BIN_OLD}/pg_ctl -D ${DATADIR} -o "-F -p ${PGPORT} -k ${TMPDIR}" -l ${LOGFILE} start || {
+  cat ${LOGFILE} && exit 1
+}
+
+echo "Creating FROM db"
+${BIN_OLD}/createdb pgis || exit 1
+${BIN_OLD}/psql -c "CREATE EXTENSION postgis" || exit 1
+
+echo "---- OLD cluster info -------------------------"
+${BIN_OLD}/psql -XAt <<EOF || exit 1
+SELECT version();
+SELECT postgis_full_version();
+EOF
+echo "-----------------------------------------------"
+
+echo "Stopping FROM cluster"
+${BIN_OLD}/pg_ctl -D ${DATADIR} stop || exit 1
+
+export PGDATAOLD=${DATADIR}.old
+mv ${DATADIR} ${PGDATAOLD}
+
+export PGDATANEW=${DATADIR}
+
+echo "Creating TO cluster"
+${BIN_NEW}/initdb ${PGDATANEW} > ${LOGFILE} 2>&1 || {
+  cat ${LOGFILE} && exit 1
+}
+
+echo "Upgrading cluster"
+cd ${TMPDIR}
+${BIN_NEW}/pg_upgrade --link -b ${BIN_OLD} -B ${BIN_NEW} > ${LOGFILE} 2>&1 ||  {
+  cat ${LOGFILE} && exit 1
+}
+
+echo "Starting TO cluster"
+${BIN_NEW}/pg_ctl -D ${DATADIR} -o "-F -p ${PGPORT} -k ${TMPDIR}" -l ${LOGFILE} start || {
+  cat ${LOGFILE} && exit 1
+}
+
+echo "---- NEW cluster info -------------------------"
+${BIN_NEW}/psql -XAx <<EOF || exit 1
+SELECT version();
+SELECT postgis_full_version();
+SELECT postgis_extensions_upgrade();
+SELECT postgis_full_version();
+EOF
+echo "-----------------------------------------------"

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

Summary of changes:
 utils/check_cluster_upgrade.sh | 109 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 109 insertions(+)
 create mode 100755 utils/check_cluster_upgrade.sh


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list