Enhance shutdown script of pgpool_setup.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Wed, 17 Jul 2019 07:48:37 +0000 (16:48 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Fri, 19 Jul 2019 07:43:06 +0000 (16:43 +0900)
I observe occasional regression test failure caused by bind error to
the TCP/IP port.  This fix tries to confirm usage of the TCP/IP port
while executing shutdown script using netstat command.

src/test/pgpool_setup

index 71c4848f12e7c007048dae2abd0ed01643a37ad7..8c8c6c74e8ef117103639da0fcf0d074cbc930c0 100755 (executable)
@@ -53,6 +53,9 @@
 # $BASEPORT + 2, $BASEPORT + 3 and so on.
 # pgpool port and pcp_port will be assigned to $BASEPORT and $BASEPORT +1 .
 BASEPORT=${BASEBOPRT:-"11000"}
+ORIGBASEPORT=$BASEPORT
+# PostgreSQL startig port number.
+PGBASEPORT=`expr $BASEPORT + 2`
 # Default number of PostgreSQL database clusters
 NUMCLUSTERS=${NUMCLUSTERS:-"2"}
 # Where to look for pgpool.conf.sample*
@@ -681,6 +684,7 @@ echo 'dir=`pwd`' > $SHUTDOWNALL
 echo "PGPOOL_INSTALL_DIR=$PGPOOL_INSTALL_DIR" >> $SHUTDOWNALL
 echo '$PGPOOL_INSTALL_DIR/bin/pgpool -f $dir/etc/pgpool.conf -m f stop' >> $SHUTDOWNALL
 echo 'while [ -f $dir/run/pgpool.pid ];do sleep 1;done' >> $SHUTDOWNALL
+echo "while  netstat -a|grep $ORIGBASEPORT ;do sleep 1;done" >> $SHUTDOWNALL
 chmod 755 $SHUTDOWNALL
 echo 'dir=`pwd`' > $PGPOOL_RELOAD
 echo "PGPOOL_INSTALL_DIR=$PGPOOL_INSTALL_DIR" >> $PGPOOL_RELOAD