From d6abdf50802f5c092dcbbd7d9b934a7a9508a55c Mon Sep 17 00:00:00 2001 From: Tatsuo Ishii Date: Fri, 30 Apr 2021 14:22:56 +0900 Subject: [PATCH] Fix watchdog_setup. watchdog_setup creates database cluster entity under pgpool0. In other pgpool nodes's pgpool.conf just has the port number for PostgreSQL in pgpool0. But backend_data_directory remains their own PostgreSQL cluster. For example: backend_data_directory0 = '/home/t-ishii/work/Pgpool-II/current/x/pgpool2/data0' This is fine until online recovery runs. If it referrers to the database cluster directory, which is not correct of course. Fix this by replacing database cluster directories with symlinks to pgppol/data0 and so on. This will reduce disk space. Also fix usage message that now Snapshot Isolation mode is supported. --- src/test/watchdog_setup.in | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/test/watchdog_setup.in b/src/test/watchdog_setup.in index 9dca33a93..60787e698 100644 --- a/src/test/watchdog_setup.in +++ b/src/test/watchdog_setup.in @@ -18,7 +18,7 @@ # this tool for production environment! # Note that this script uses pgpool_setup as a work horse. # -# usage: watchdog_setup [-wn num_pgpool][-wp watchdog_base_port][-m r|s|n][-n num_clusters][-p base_port][--no-stop][-d] +# usage: watchdog_setup [-wn num_pgpool][-wp watchdog_base_port][-m r|s|n|i][-n num_clusters][-p base_port][--no-stop][-d] # -wn num_pgpool: create num_pgpool pgpool nodes. The default is 3. Must be greater than 1. # -wp watchdog_base_port: starting port number. The default is # 50000. @@ -107,7 +107,7 @@ function set_pgpool_conf { echo "recovery_password = ''" >> $CONF echo "recovery_1st_stage_command = 'basebackup.sh'" >> $CONF - if [ $MODE = "r" ];then + if [ $MODE = "r" || $MODE = "i" ];then echo "recovery_2nd_stage_command = 'pgpool_recovery_pitr'" >> $CONF fi @@ -305,9 +305,15 @@ do sed -i '/.*data.*/d' startall sed -i '/.*data.*/d' shutdownall - # replace database cluster path to pgpool0 so that pgpool1 etc. share the cluster - PGPOOLCONF=etc/pgpool.conf - sed -i "/backend_data_directory/s/pgpool$cnt/pgpool0/g" $PGPOOLCONF + # change database cluster directory symlink to pgpool0. + # The database cluster entity only resides in pgpool0. + n=0 + while [ $n -lt $NUMCLUSTERS ] + do + rm -fr data$n + ln -s ../pgpool0/data$n . + n=`expr $n + 1` + done fi echo "cd pgpool$cnt" >> $STARTALL -- 2.39.5