[pgpool-hackers: 4146] 014.watchdog_test_quorum_bypass/test.sh

Tatsuo Ishii ishii at sraoss.co.jp
Thu Mar 31 13:35:49 JST 2022


Hi Usama,

I am confused by a regression test originally created by you in this commit:
https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=9f12b15f322e9094873ff6039b7d4de7cd019baa

Then the directory was renamed to this to fix typo:
https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=f1224167920d5fb3e2dae5d903bf66211bb9a71a

However the test script is basically same as the original.

I looked into the script and found that the test does not enable
watchdog although the test name and the comment suggests it uses
watchdog. Am I missing something?

Best reagards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp


#!/usr/bin/env bash
#-------------------------------------------------------------------
# test script for watchdog
#
# Please note that to successfully run the test, "HEALTHCHECK_DEBUG"
# must be defined before compiling main/health_check.c.
#
# test pcp_detach bypass failover_when_quorum_exists and failover_require_consensus
#
source $TESTLIBS
LEADER_DIR=leader
num_tests=2
success_count=0
PSQL=$PGBIN/psql
PG_CTL=$PGBIN/pg_ctl

rm -fr $LEADER_DIR
rm -fr $STANDBY_DIR
rm -fr $STANDBY2_DIR

mkdir $LEADER_DIR
mkdir $STANDBY_DIR
mkdir $STANDBY2_DIR


# dir in leader directory
cd $LEADER_DIR

# create leader environment
echo -n "creating leader pgpool and PostgreSQL clusters..."
$PGPOOL_SETUP -m s -n 2 -p 11000|| exit 1
echo "leader setup done."


source ./bashrc.ports
cat ../leader.conf >> etc/pgpool.conf
echo 0 > etc/pgpool_node_id

./startall
wait_for_pgpool_startup


# back to test root dir
cd ..


# First test check if pgpool-II became a leader.
echo "Waiting for the pgpool leader..."
for i in 1 2 3 4 5 6 7 8 9 10
do
	grep "I am the cluster leader node" $LEADER_DIR/log/pgpool.log > /dev/null 2>&1
	if [ $? = 0 ];then
		success_count=$(( success_count + 1 ))
		echo "Leader brought up successfully."
		break;
	fi
	echo "[check] $i times"
	sleep 2
done

#export PCPPASSFILE=/home/usama/work/community/pgpool2/src/test/regression/tests/067.bug231/testdir/pcppass
$PGPOOL_INSTALL_DIR/bin/pcp_detach_node -w -h localhost -p $PCP_PORT 1 2>&1

wait_for_pgpool_startup

$PSQL -p 11000 -c "show pool_nodes" test|grep standby|grep down >/dev/null 2>&1
if [ $? = 0 ];then
    echo "Failover was successfully executed"
	success_count=$(( success_count + 1 ))
fi

cd leader
./shutdownall

echo "$success_count out of $num_tests successful";

if test $success_count -eq $num_tests
then
    exit 0
fi

exit 1


More information about the pgpool-hackers mailing list