pgpool2.git / summary / log / commit / refs
commit ba58dc99d77f3b415399a59685c502ebcc3a005d
Author: Tatsuo Ishii <ishii@sraoss.co.jp>
Date: Sun Apr 17 12:48:51 2022 +0000
Test: stabilize 018.detach_primary.
The test occasionally failed with timeout. The cause seems the test
proceeds before watchdog are ready. So wait till watchdog is ready
using pcp_watchdog_info.
.../regression/tests/018.detach_primary/test.sh | 34 +++++++++++++++++-----
1 file changed, 27 insertions(+), 7 deletions(-)
diff --git a/src/test/regression/tests/018.detach_primary/test.sh b/src/test/regression/tests/018.detach_primary/test.sh
index f6638b1ca..279e41772 100755
--- a/src/test/regression/tests/018.detach_primary/test.sh
+++ b/src/test/regression/tests/018.detach_primary/test.sh
@@ -84,7 +84,7 @@ wait_for_pgpool_startup
# promote #3 node to create false primary
$PG_CTL -D pgpool0/data2 promote
-sleep 10
+
wait_for_pgpool_startup
$PSQL -c "show pool_nodes" postgres|grep down
@@ -102,16 +102,36 @@ cd ..
cd pgpool2
./startall
cd ..
-sleep 10
-date
+
wait_for_pgpool_startup
-date
+
$PGPOOL_INSTALL_DIR/bin/pcp_watchdog_info -v -w -h localhost -p $PCP_PORT
-$PSQL -c "show pool_nodes" postgres
+date
+for i in {1..30}
+do
+ cnt=`$PGPOOL_INSTALL_DIR/bin/pcp_watchdog_info -v -w -h localhost -p $PCP_PORT|egrep "MASTER|LEADER|STANDBY"|wc -l`
+ if [ $cnt = 3 ];then
+ echo "watchdog is ready"
+ break
+ fi
+ sleep 1
+done
+date
-$PSQL -c "show pool_nodes" postgres|grep down
-if [ $? != 0 ];then
+ok=n
+for i in {1..10}
+do
+ $PSQL -c "show pool_nodes" postgres
+ $PSQL -c "show pool_nodes" postgres|grep down
+ if [ $? = 0 ];then
+ ok=y
+ break
+ fi
+ sleep 1
+done
+
+if [ $ok != 'y' ];then
echo "node is not down despite that the quorum exists"
./shutdownall
exit 1
[parent: 8b41396c3e8e]