From 2c9c23629d567c572b83cede0bc42a9877effeff Mon Sep 17 00:00:00 2001 From: Tatsuo Ishii Date: Tue, 12 Nov 2024 18:36:08 +0900 Subject: [PATCH] Test: add test for COPY FROM STDIN hang. This is a follow up commit for commit: ab091663b09ef8c2d0a1841921597948c597444e Add test case using pgproto to existing 076.copy_hang. Backpatch-through: v4.1 --- .../regression/tests/076.copy_hang/pgproto.data | 9 +++++++++ src/test/regression/tests/076.copy_hang/test.sh | 17 +++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 src/test/regression/tests/076.copy_hang/pgproto.data diff --git a/src/test/regression/tests/076.copy_hang/pgproto.data b/src/test/regression/tests/076.copy_hang/pgproto.data new file mode 100644 index 000000000..ce6eeebc1 --- /dev/null +++ b/src/test/regression/tests/076.copy_hang/pgproto.data @@ -0,0 +1,9 @@ +'Q' "CREATE TEMP TABLE t1(i INT)" +'Y' +'Q' "COPY t1 FROM STDIN" 0 +'d' "1" +'H' +'c' +'S' +'Y' +'X' diff --git a/src/test/regression/tests/076.copy_hang/test.sh b/src/test/regression/tests/076.copy_hang/test.sh index 2abe488ed..9e0f4c0ce 100755 --- a/src/test/regression/tests/076.copy_hang/test.sh +++ b/src/test/regression/tests/076.copy_hang/test.sh @@ -17,6 +17,7 @@ source $TESTLIBS TESTDIR=testdir PSQL=$PGBIN/psql +PGPROTO=$PGPOOL_INSTALL_DIR/bin/pgproto rm -fr $TESTDIR mkdir $TESTDIR @@ -46,9 +47,21 @@ g EOF if [ ! $? -eq 0 ];then - echo ...timed out. ./shutdownall exit 1 fi -echo ...ok. + +# +# Another COPY FROM STDIN hang case. +# commit ab091663b09ef8c2d0a1841921597948c597444e +# If Flush or Sync message is sent from frontend during COPY IN mode, +# pgpool hangs. +# In order to reproduce the problem, we use pgproto because psql +# cannot send Flush or Sync during COPY FROM STDIN + +timeout 10 $PGPROTO -d test -f ../pgproto.data +if [ ! $? -eq 0 ];then + ./shutdownall + exit 1 +fi ./shutdownall -- 2.39.5