pgpool2.git / summary / log / commit / refs

commit    0920faac9daeb4ccc280a5a17bb443acd6e498c9
Author:   Tatsuo Ishii <ishii@postgresql.org>
Date:     Sat Nov 29 01:43:00 2014 +0000

    Reorganize port numbers assigned in pgool_setup.
    
    Assign base port (11000 by default) to pgpool, base port + 1 to pcp,
    port + 2 to PostgreSQL node0, port + 3 to PostgreSQL node1 and so on.
    This assigns fixed port numbers to pgpool and pcp port, which makes
    pgpool_setup user's life a little bit easier, because they don't need
    to check README.port to make sure the pgpool and pcp port any more.
    
    Some of regression tests uses immediate numeric port numbers and
    adjusted to meet the change.


src/test/pgpool_setup | 26 +++++++++++++--------- .../tests/002.native_replication/test.sh | 4 ++-- src/test/regression/tests/003.failover/expected.r | 4 ++-- src/test/regression/tests/003.failover/expected.s | 4 ++-- src/test/regression/tests/004.watchdog/master.conf | 2 +- .../regression/tests/004.watchdog/standby.conf | 6 ++--- src/test/regression/tests/054.postgres_fdw/test.sh | 10 ++++----- .../regression/tests/055.backend_all_down/test.sh | 2 +- 8 files changed, 32 insertions(+), 26 deletions(-) diff --git a/src/test/pgpool_setup b/src/test/pgpool_setup index fdd23e094..3dae411da 100755 --- a/src/test/pgpool_setup +++ b/src/test/pgpool_setup @@ -23,10 +23,10 @@ # -m r: create an installation as native replication mode. # -m n: create an installation as raw mode. # -n num_clusters: create num_clusters PostgreSQL database cluster nodes -# -p base_port: specify base port. The first PostgreSQL node's port is -# base_port. Second PostgreSQL node's port is base_port+1... nth -# PostgreSQL node's port is base_port+n-1, pgpool port is -# base_port+n, pcp port is base_port+n+1. +# -p base_port: specify base port. pgpool port is base_port. +# pcp port is base_port + 1. The first PostgreSQL node's port is +# base_port + 2, second PostgreSQL node's port is base_port + 3 +# and so on. # --no-stop: do not stop pgpool and PostgreSQL after the work # # The user run this script will become the PostgreSQL super user as @@ -50,11 +50,11 @@ # Configuration section #------------------------------------------- # Starting port number to be used. Each PostgreSQL is assigned -# $BASEPORT, $BASEPORT+1 and so on. -# pgpool port and pcp_port will be assigned afterwards. -BASEPORT=11000 +# $BASEPORT + 2, $BASEPORT + 3 and so on. +# pgpool port and pcp_port will be assigned to $BASEPORT and $BASEPORT +1 . +BASEPORT=${BASEBOPRT:-"11000"} # Default number of PostgreSQL database clusters -NUMCLUSTERS=2 +NUMCLUSTERS=${NUMCLUSTERS:-"2"} # Where to look for pgpool.conf.sample* PGPOOL_INSTALL_DIR=${PGPOOL_INSTALL_DIR:-"/usr/local"} PGPOOLDIR=${PGPOOLDIR:-${PGPOOL_INSTALL_DIR}/etc} @@ -613,6 +613,12 @@ exec 5> $BASEDIR/pgpool_setup.log #------------------------------------------- echo "Satrting set up in $MODENAME" +#------------------------------------------- +# assign base port for PostgreSQL +#------------------------------------------- +ORIG_BASEPORT=$BASEPORT +BASEPORT=`expr $BASEPORT + 2` + #------------------------------------------- # install pgpool.conf #------------------------------------------- @@ -691,9 +697,9 @@ done set_pgpool_conf $CONF -PGPOOL_PORT=`expr $PORT + 1` +PGPOOL_PORT=$ORIG_BASEPORT echo "port = $PGPOOL_PORT" >> $CONF -PCP_PORT=`expr $PORT + 2` +PCP_PORT=`expr $PGPOOL_PORT + 1` echo "pcp_port = $PCP_PORT" >> $CONF test ! -d run && mkdir run diff --git a/src/test/regression/tests/002.native_replication/test.sh b/src/test/regression/tests/002.native_replication/test.sh index e05912ba9..70e855924 100755 --- a/src/test/regression/tests/002.native_replication/test.sh +++ b/src/test/regression/tests/002.native_replication/test.sh @@ -50,11 +50,11 @@ java PgTester 100 & java PgTester 1000 & wait -$PSQL -p 11000 test <<EOF +$PSQL -p 11002 test <<EOF \copy (SELECT * FROM t1 ORDER BY i) to 'dump0.txt' EOF -$PSQL -p 11001 test <<EOF +$PSQL -p 11003 test <<EOF \copy (SELECT * FROM t1 ORDER BY i) to 'dump1.txt' EOF diff --git a/src/test/regression/tests/003.failover/expected.r b/src/test/regression/tests/003.failover/expected.r index 8a23495b7..ec35e4b1e 100644 --- a/src/test/regression/tests/003.failover/expected.r +++ b/src/test/regression/tests/003.failover/expected.r @@ -1,6 +1,6 @@ node_id | hostname | port | status | lb_weight | role ---------+----------+-------+--------+-----------+-------- - 0 | /tmp | 11000 | 2 | 0.500000 | master - 1 | /tmp | 11001 | 3 | 0.500000 | slave + 0 | /tmp | 11002 | 2 | 0.500000 | master + 1 | /tmp | 11003 | 3 | 0.500000 | slave (2 rows) diff --git a/src/test/regression/tests/003.failover/expected.s b/src/test/regression/tests/003.failover/expected.s index 5dba92297..6150f4990 100644 --- a/src/test/regression/tests/003.failover/expected.s +++ b/src/test/regression/tests/003.failover/expected.s @@ -1,6 +1,6 @@ node_id | hostname | port | status | lb_weight | role ---------+----------+-------+--------+-----------+--------- - 0 | /tmp | 11000 | 2 | 0.500000 | primary - 1 | /tmp | 11001 | 3 | 0.500000 | standby + 0 | /tmp | 11002 | 2 | 0.500000 | primary + 1 | /tmp | 11003 | 3 | 0.500000 | standby (2 rows) diff --git a/src/test/regression/tests/004.watchdog/master.conf b/src/test/regression/tests/004.watchdog/master.conf index 900fc0878..d208bb57f 100644 --- a/src/test/regression/tests/004.watchdog/master.conf +++ b/src/test/regression/tests/004.watchdog/master.conf @@ -8,5 +8,5 @@ heartbeat_destination_port0 = 11005 heartbeat_destination1 = 'localhost' heartbeat_destination_port1 = 11105 other_pgpool_hostname1 = 'localhost' -other_pgpool_port1 = 11102 +other_pgpool_port1 = 11100 other_wd_port1 = 11104 diff --git a/src/test/regression/tests/004.watchdog/standby.conf b/src/test/regression/tests/004.watchdog/standby.conf index c653883a9..9a530b6a8 100644 --- a/src/test/regression/tests/004.watchdog/standby.conf +++ b/src/test/regression/tests/004.watchdog/standby.conf @@ -8,12 +8,12 @@ heartbeat_destination_port0 = 11105 heartbeat_destination1 = 'localhost' heartbeat_destination_port1 = 11005 other_pgpool_hostname1 = 'localhost' -other_pgpool_port1 = 11002 +other_pgpool_port1 = 11000 other_wd_port1 = 11004 backend_hostname0 = '' -backend_port0 = 11000 +backend_port0 = 11002 backend_weight0 = 1 backend_hostname1 = '' -backend_port1 = 11001 +backend_port1 = 11003 backend_weight1 = 1 diff --git a/src/test/regression/tests/054.postgres_fdw/test.sh b/src/test/regression/tests/054.postgres_fdw/test.sh index 37847d47a..0eba9d7fd 100755 --- a/src/test/regression/tests/054.postgres_fdw/test.sh +++ b/src/test/regression/tests/054.postgres_fdw/test.sh @@ -29,15 +29,15 @@ export PGPORT=$PGPOOL_PORT wait_for_pgpool_startup # create foreign table -$PSQL -p 11001 test <<EOF +$PSQL -p 11003 test <<EOF CREATE EXTENSION postgres_fdw; -CREATE SERVER pgpool FOREIGN DATA WRAPPER postgres_fdw OPTIONS (dbname 'test', port '11002'); +CREATE SERVER pgpool FOREIGN DATA WRAPPER postgres_fdw OPTIONS (dbname 'test', port '11000'); CREATE USER MAPPING FOR PUBLIC SERVER pgpool; CREATE FOREIGN TABLE fr1(i INTEGER) SERVER pgpool; EOF # create remote table -$PSQL -p 11000 test <<EOF +$PSQL -p 11002 test <<EOF CREATE TABLE fr1(i INTEGER); EOF @@ -50,8 +50,8 @@ if [ $? != 0 ];then exit 1 fi -# access foreign table 11001(PostgreSQL)->11002(pgpool)->11000(PostgreSQL) -$PSQL -p 11001 test <<EOF +# access foreign table 11003(PostgreSQL)->11000(pgpool)->11002(PostgreSQL) +$PSQL -p 11003 test <<EOF SELECT * FROM fr1; INSERT INTO fr1 VALUES(1); -- should call pgpool_regclass EOF diff --git a/src/test/regression/tests/055.backend_all_down/test.sh b/src/test/regression/tests/055.backend_all_down/test.sh index 858563a49..7cfe8625b 100755 --- a/src/test/regression/tests/055.backend_all_down/test.sh +++ b/src/test/regression/tests/055.backend_all_down/test.sh @@ -31,7 +31,7 @@ sh pgpool.sh while true do - grep 'failover done. shutdown host /tmp(11001)' log/pgpool.log > /dev/null 2>&1 + grep 'failover done. shutdown host /tmp(11003)' log/pgpool.log > /dev/null 2>&1 if [ $? = 0 ];then break; fi [parent: 2f6a27f40d4e]