Skip to content

Commit 48e0b8a

Browse files
committed
Prevent creation of postmaster's TCP socket during pg_upgrade testing.
On non-Windows machines, we use the Unix socket for connections to test postmasters, so there is no need to create a TCP socket. Furthermore, doing so causes failures due to port conflicts if two builds are carried out concurrently on one machine. (If the builds are done in different chroots, which is standard practice at least in Red Hat distros, there is no risk of conflict on the Unix socket.) Suppressing the TCP socket by setting listen_addresses to empty has long been standard practice for pg_regress, and pg_upgrade knows about this too ... but pg_upgrade's test.sh didn't get the memo. Back-patch to 9.2, and also sync the 9.2 version of the script with HEAD as much as practical.
1 parent b4c99c9 commit 48e0b8a

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

contrib/pg_upgrade/test.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ export PGPORT
1717

1818
testhost=`uname -s`
1919

20+
case $testhost in
21+
MINGW*) LISTEN_ADDRESSES="localhost" ;;
22+
*) LISTEN_ADDRESSES="" ;;
23+
esac
24+
25+
POSTMASTER_OPTS="-F -c listen_addresses=$LISTEN_ADDRESSES"
26+
2027
temp_root=$PWD/tmp_check
2128

2229
if [ "$1" = '--install' ]; then
@@ -71,10 +78,11 @@ logdir=$PWD/log
7178
rm -rf "$logdir"
7279
mkdir "$logdir"
7380

81+
# enable echo so the user can see what is being executed
7482
set -x
7583

7684
$oldbindir/initdb
77-
$oldbindir/pg_ctl start -l "$logdir/postmaster1.log" -w
85+
$oldbindir/pg_ctl start -l "$logdir/postmaster1.log" -o "$POSTMASTER_OPTS" -w
7886
if "$MAKE" -C "$oldsrc" installcheck; then
7987
pg_dumpall -f "$temp_root"/dump1.sql || pg_dumpall1_status=$?
8088
if [ "$newsrc" != "$oldsrc" ]; then
@@ -117,7 +125,7 @@ initdb
117125

118126
pg_upgrade -d "${PGDATA}.old" -D "${PGDATA}" -b "$oldbindir" -B "$bindir"
119127

120-
pg_ctl start -l "$logdir/postmaster2.log" -w
128+
pg_ctl start -l "$logdir/postmaster2.log" -o "$POSTMASTER_OPTS" -w
121129

122130
case $testhost in
123131
MINGW*) cmd /c analyze_new_cluster.bat ;;
@@ -126,6 +134,11 @@ esac
126134

127135
pg_dumpall -f "$temp_root"/dump2.sql || pg_dumpall2_status=$?
128136
pg_ctl -m fast stop
137+
138+
# no need to echo commands anymore
139+
set +x
140+
echo
141+
129142
if [ -n "$pg_dumpall2_status" ]; then
130143
echo "pg_dumpall of post-upgrade database cluster failed"
131144
exit 1

0 commit comments

Comments
 (0)