pgpool2.git / summary / log / commit / refs

commit    8b803e1ea38c3ac9a7775f7fb9ba43870bca7dca
Author:   Yugo Nagata <nagata@sraoss.co.jp>
Date:     Mon Jul 08 01:18:50 2013 +0000

    Add wait_for_pgpool_reload function
    
    This avoids pgpool recovery before new backends information reloaded.


test/pgpool_setup | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/test/pgpool_setup b/test/pgpool_setup index 1049d0b59..f546d6902 100755 --- a/test/pgpool_setup +++ b/test/pgpool_setup @@ -26,6 +26,7 @@ # The user run this script will become the PostgreSQL super user as # well. Current directory must be empty. Assume that appropreate # pgpool and PostgreSQL binaries are in the command search path. +# The user must have passwordless access to localhost over SSH. # # Rayout after executing this script: # data[0-]: PostgreSQL database clusters @@ -232,7 +233,7 @@ DEST=$1 DESTDIR=$2 PGCTL=__PGBIN__/pg_ctl -ssh -T $DEST $PGCTL -w -D $DESTDIR start 2>/dev/null 1>/dev/null < /dev/null & +ssh -T $PGCTL -w -D $DESTDIR start 2>/dev/null 1>/dev/null < /dev/null & EOF #------------------------------------------- @@ -559,6 +560,23 @@ function wait_for_pgpool_startup { done } +#------------------------------------------- +# wait for pgpool reload finished +#------------------------------------------- +function wait_for_pgpool_reload { + timeout=20 + num_node=$1 + + while [ $timeout -gt 0 ] + do + N=`$PSQL -p $PGPOOL_PORT -c "show pool_status" test | grep backend_data | wc -l` + if [ $N = $num_node ];then + break; + fi + timeout=`expr $timeout - 1` + done +} + ################################################################################# # # main script @@ -773,6 +791,7 @@ EOF pgpool -f $BASEDIR/etc/pgpool.conf reload fi + wait_for_pgpool_reload $NUMCLUSTERS $PSQL -p $PGPOOL_PORT -c "show pool_nodes" test # recovery data1 and so on [parent: fb47923d6381]