From c7f9e7ccfd770942fdaa081fdc93ed4a793d6536 Mon Sep 17 00:00:00 2001 From: Tatsuo Ishii Date: Sat, 29 May 2021 17:32:38 +0900 Subject: [PATCH] Enhance watchdog_setup script. shutdownall script generated by watchdog_setup shutdowns in the node number order i.e.: 0, 1, 2... This causes PostgreSQL backend shutdown when pgpool0 node went down and node 1, 2... trigger failover event, which is not necessary in the whole shutdown sequence. Shutting down in the reverse order (...2, 1, 0) should prevent this and shorten the whole shutdown sequence. Also this should prevent occasional 018.detach_primary and 028.watchdog_enable_consensus_with_half_votes test timeout (they use watchdog_setup). --- src/test/watchdog_setup.in | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/test/watchdog_setup.in b/src/test/watchdog_setup.in index 3c697da11..966205d66 100644 --- a/src/test/watchdog_setup.in +++ b/src/test/watchdog_setup.in @@ -327,13 +327,21 @@ do echo "cd pgpool$cnt" >> $STARTALL echo "./startall" >> $STARTALL echo "cd .." >> $STARTALL - echo "cd pgpool$cnt" >> $SHUTDOWNALL - echo "./shutdownall" >> $SHUTDOWNALL - echo "cd .." >> $SHUTDOWNALL cd .. cnt=`expr $cnt + 1` done +# shutdown needs to be performed in reverse order because shutdown of +# PostgreSQL servers must be executed in pgpoo0. +cnt=$W_NUM_PGPOOL +while [ $cnt -gt 0 ] +do + cnt=`expr $cnt - 1` + echo "cd pgpool$cnt" >> $SHUTDOWNALL + echo "./shutdownall" >> $SHUTDOWNALL + echo "cd .." >> $SHUTDOWNALL +done + chmod 755 $STARTALL chmod 755 $SHUTDOWNALL -- 2.39.5