Test: fix occasional 069.memory_leak_extended test failure.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Mon, 22 May 2023 07:27:40 +0000 (16:27 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Mon, 22 May 2023 07:32:43 +0000 (16:32 +0900)
It turned out that reason of the occasional test failure is, pgpool
child process is gone before running ps command after pgbench
finishes. The cause is a kind mismatch FATAL error, "DISCARD ALL
cannot be executed within a pipeline". To fix this, run pgbench in
background and get the process size before pgbench finishes.

Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2023-May/004338.html

src/test/regression/tests/069.memory_leak_extended/test.sh

index 975becbecb2600dc57bdb8aae94db528bee4d473..87802608f9894968308a0ecd9c38a54caa1b7ee5 100755 (executable)
@@ -43,14 +43,25 @@ do
        init_size=`ps l $pid|tail -1|awk '{print $7}'`
        echo "init_size: $init_size"
 
-       # run pgbench for a while
-       $PGBENCH -M extended -S -T 30 test
+       # run pgbench for a while in background.
+       echo "Starting pgbench in background"
+       date
+       $PGBENCH -M extended -S -T 30 test &
 
+       # sleep 29 seconds so that we can get the process size before
+       # pgpool process $pid accidentaly exits.
+       sleep 29
+
+       date
        after_size=`ps l $pid|tail -1|awk '{print $7}'`
        delta=`expr $after_size - $init_size`
 
        echo "initial process size: $init_size after size: $after_size delta: $delta"
 
+       wait
+       echo "pgbench done."
+       date
+
        test $delta -eq 0
 
        if [ $? != 0 ];then