Skip to content

Commit 45bde95

Browse files
committed
Add pg_upgrade coverage to Woodie CI
Add a Woodpecker regression step that installs the PostgreSQL 14 and 18 builds, then runs the cluster upgrade helper across them. Seed that upgrade with a geography table shape matching the failure reported in ticket #5899, so pg_upgrade coverage exercises PostGIS data before postgis_extensions_upgrade(). Make the helper initialize newer target clusters without data checksums when supported, matching the historical default used by older clusters, and stop the upgraded cluster during cleanup. Closes #5995
1 parent c94f623 commit 45bde95

4 files changed

Lines changed: 43 additions & 3 deletions

File tree

.woodpecker/regress.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,11 @@ steps:
131131
- <<: *steps-start-postgresql
132132
- <<: *steps-pg-install
133133
- <<: *steps-pg-test-all-upgrades
134+
135+
cluster-upgradecheck-pg14-to-pg18:
136+
image: *test-image
137+
depends_on: [ installcheck-pg14, installcheck-pg18 ]
138+
commands:
139+
- make -C build/pg14 install
140+
- make -C build/pg18 install
141+
- su postgres -c 'utils/check_cluster_upgrade.sh -i regress/hooks/cluster-upgrade-geography.sql /usr/lib/postgresql/14/bin/pg_config /usr/lib/postgresql/18/bin/pg_config'

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ To take advantage of all postgis_sfcgal extension features SFCGAL 2.3+ is needed
6262
(Darafei Praliaskouski)
6363
- #2804, #4315, [raster] Support two-argument ST_MapAlgebra callbacks
6464
and pass callback call data as actual arguments (Darafei Praliaskouski)
65+
- #5995, Add pg_upgrade coverage to Woodie CI
66+
(Darafei Praliaskouski)
6567
- #2898, Document SQL function cost tiers for contributors
6668
(Darafei Praliaskouski)
6769
- #6062, [topology] Stop using recursive snapping, for improved robustness (Sandro Santilli)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
CREATE EXTENSION postgis;
2+
3+
CREATE SCHEMA procsch;
4+
5+
CREATE TABLE procsch."MyTab" (
6+
"id" bigint,
7+
"loc" public.geography(Point, 4283)
8+
);
9+
10+
INSERT INTO procsch."MyTab"
11+
VALUES (1, 'SRID=4283;POINT(152.138672 -30.689888)'::geography);
12+
13+
SELECT count(*) FROM procsch."MyTab";

utils/check_cluster_upgrade.sh

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,15 @@ usage() {
1616

1717
cleanup() {
1818
echo "-- Cleaning up --"
19-
echo "Stopping postmaster on ${DATADIR} up"
20-
${BIN_OLD}/pg_ctl -D ${DATADIR} stop
19+
if test -f "${DATADIR}/postmaster.pid"; then
20+
if test -n "${BIN_NEW}"; then
21+
echo "Stopping postmaster on ${DATADIR}"
22+
${BIN_NEW}/pg_ctl -D ${DATADIR} stop
23+
else
24+
echo "Stopping postmaster on ${DATADIR}"
25+
${BIN_OLD}/pg_ctl -D ${DATADIR} stop
26+
fi
27+
fi
2128
echo "Removing ${TMPDIR}"
2229
rm -rf ${TMPDIR}
2330
}
@@ -56,6 +63,11 @@ if test -z "$PG_CONFIG_NEW"; then
5663
exit 1
5764
fi
5865

66+
if test "$(id -u)" = "0"; then
67+
echo "This script must be run as an unprivileged PostgreSQL cluster owner, not root" >&2
68+
exit 1
69+
fi
70+
5971
if test "$PG_CONFIG_OLD" = "$PG_CONFIG_NEW"; then
6072
echo "Old and new pg_config paths need be different" >&2
6173
exit 1
@@ -64,6 +76,11 @@ fi
6476
BIN_OLD=$(${PG_CONFIG_OLD} --bindir)
6577
BIN_NEW=$(${PG_CONFIG_NEW} --bindir)
6678

79+
INITDB_NEW_OPTS=
80+
if ${BIN_NEW}/initdb --help | grep -q -- "--no-data-checksums"; then
81+
INITDB_NEW_OPTS=--no-data-checksums
82+
fi
83+
6784
echo "Testing cluster upgrade"
6885
echo "FROM: $(${PG_CONFIG_OLD} --version)"
6986
echo " TO: $(${PG_CONFIG_NEW} --version)"
@@ -104,7 +121,7 @@ mv ${DATADIR} ${PGDATAOLD}
104121
export PGDATANEW=${DATADIR}
105122

106123
echo "Creating TO cluster"
107-
${BIN_NEW}/initdb ${PGDATANEW} > ${LOGFILE} 2>&1 || {
124+
${BIN_NEW}/initdb ${INITDB_NEW_OPTS} ${PGDATANEW} > ${LOGFILE} 2>&1 || {
108125
cat ${LOGFILE} && exit 1
109126
}
110127

0 commit comments

Comments
 (0)