pgpool2.git / summary / log / commit / refs
commit 36dd9c59c070d67033005b7dba1f92d22d34a1eb
Author: Yugo Nagata <nagata@sraoss.co.jp>
Date: Wed Aug 19 04:11:25 2015 +0000
Fix regress test to sleep after pgpool_reload
Some regression tests test behaviors after pgpool-II configuration
is modified and reloaded. However, sometimes these modification
were not applied to pgpool just after reloading.
It was observed after the following commit.
commit ba24a708ed61d6a5fa296451b194c4b448ed5966
Author: Tatsuo Ishii <ishii@postgresql.org>
Date: Thu Aug 6 13:02:42 2015 +0900
Issue fsync() when writing pgpool_status.
This ensures that pgpool_status is saved to permanent storage and
allow to survive after system crash.
It seem to be because fsync() takes a time before SIGHUP is sent
to child processes in reload_config().
Fix is to add sleep to wait for applying modification after
pgpool_reload.
In addition, some messages are added to test for debugging.
src/test/regression/tests/001.load_balance/test.sh | 12 +++++++++++-
src/test/regression/tests/008.dbredirect/test.sh | 1 +
src/test/regression/tests/009.sql_comments/test.sh | 1 +
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/test/regression/tests/001.load_balance/test.sh b/src/test/regression/tests/001.load_balance/test.sh
index 6d3412003..89df6a4b5 100755
--- a/src/test/regression/tests/001.load_balance/test.sh
+++ b/src/test/regression/tests/001.load_balance/test.sh
@@ -36,26 +36,31 @@ SELECT * FROM t1; -- this load balances
SELECT f1(1); -- this does not load balance
EOF
-# check if simle load balance worked
+# check if simple load balance worked
fgrep "SELECT * FROM t1;" log/pgpool.log |grep "DB node id: 1">/dev/null 2>&1
if [ $? != 0 ];then
# expected result not found
+ echo fail: select is sent to zero-weight node.
./shutdownall
exit 1
fi
+ echo ok: load balance works.
# check if black function list worked
fgrep "SELECT f1(1);" log/pgpool.log |grep "DB node id: 0">/dev/null 2>&1
if [ $? != 0 ];then
# expected result not found
+ echo fail: black function is sent to node 1.
./shutdownall
exit 1
fi
+ echo ok: black function list works.
echo "white_function_list = 'f1'" >> etc/pgpool.conf
echo "black_function_list = ''" >> etc/pgpool.conf
./pgpool_reload
+ sleep 1
$PSQL test <<EOF
SELECT f1(1); -- this does load balance
@@ -65,9 +70,11 @@ EOF
fgrep "SELECT f1(1);" log/pgpool.log |grep "DB node id: 1">/dev/null 2>&1
if [ $? != 0 ];then
# expected result not found
+ echo fail: white function is sent to zero-weight node.
./shutdownall
exit 1
fi
+ echo ok: white function list works.
# in replication mode if load_balance_mode = off, SELECT query inside
# an explicit transaction should be sent to master only.
@@ -89,6 +96,7 @@ EOF
fgrep "SELECT 1;" log/pgpool.log |grep "DB node id: 1">/dev/null 2>&1
if [ $? != 0 ];then
# the SELECT should not be executed on node 1
+ echo ok: select is sent to only master when not load-blanced.
ok=1
fi
# the SELECT should be executed on node 0
@@ -100,6 +108,7 @@ EOF
echo "black_function_list = 'f1'" >> etc/pgpool.conf
echo "white_function_list = ''" >> etc/pgpool.conf
./pgpool_reload
+ sleep 1
$PSQL test <<EOF
SELECT f1(2); -- this should be sent to all the nodes
EOF
@@ -108,6 +117,7 @@ EOF
fgrep "SELECT f1(2);" log/pgpool.log |grep "DB node id: 1">/dev/null 2>&1
if [ $? = 0 ];then
# the SELECT should be executed on node 0 & 1
+ echo ok: black function is sent to all nodes.
ok=`expr $ok + 1`
fi
# the SELECT should be executed on node 0
diff --git a/src/test/regression/tests/008.dbredirect/test.sh b/src/test/regression/tests/008.dbredirect/test.sh
index d598882a7..0489b117a 100755
--- a/src/test/regression/tests/008.dbredirect/test.sh
+++ b/src/test/regression/tests/008.dbredirect/test.sh
@@ -60,6 +60,7 @@ test `getnode "test4"` -eq 1 -o `getnode "test4"` -eq 2 || ok=ng
echo "app_name_redirect_preference_list = 'psql:primary,pgbench:standby'" >> etc/pgpool.conf
./pgpool_reload
+sleep 1
wait_for_pgpool_startup
diff --git a/src/test/regression/tests/009.sql_comments/test.sh b/src/test/regression/tests/009.sql_comments/test.sh
index 02eefe47b..cccf37d9d 100755
--- a/src/test/regression/tests/009.sql_comments/test.sh
+++ b/src/test/regression/tests/009.sql_comments/test.sh
@@ -51,6 +51,7 @@ test `getnode "case3"` -eq 0 || ok=ng
echo "allow_sql_comments = on" >> etc/pgpool.conf
./pgpool_reload
+sleep 1
wait_for_pgpool_startup
[parent: 37b979950cc7]