From 408c8351186951e6225c60afa7dc91d32bf2ccf6 Mon Sep 17 00:00:00 2001 From: Muhammad Usama Date: Mon, 5 Aug 2024 12:13:21 +0500 Subject: [PATCH 2/2] Enhance Regression Script to Support Pooling Mode Selection and Verbose Logging This commit enhances the regression script to allow selecting the pooling mode (classic or global) for regression runs and adds a new '-v' switch to the regression script that enables verbose output of the Pgpool log. see 'regress.sh -?' for details --- src/test/pgpool_setup.in | 5 +++++ src/test/regression/regress.sh | 13 ++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/test/pgpool_setup.in b/src/test/pgpool_setup.in index 3823d85f..54c220f1 100644 --- a/src/test/pgpool_setup.in +++ b/src/test/pgpool_setup.in @@ -897,10 +897,15 @@ function set_pgpool_conf { echo "pcp_socket_dir = '$PGSOCKET_DIR'" >> $CONF echo "logging_collector = off" >> $CONF echo "log_line_prefix = '%m: %a pid %p: '" >> $CONF + echo "connection_pool_type = $POOLING_MODE" >> $CONF if [ $ENABLE_TEST = "true" ];then echo "health_check_test = on" >> $CONF fi + if [ $POOL_VERBOSE_OUTPUT = "true" ];then + echo "log_error_verbosity = verbose" >> $CONF + fi + } #------------------------------------------- diff --git a/src/test/regression/regress.sh b/src/test/regression/regress.sh index fd44415c..fcfa27c9 100755 --- a/src/test/regression/regress.sh +++ b/src/test/regression/regress.sh @@ -23,6 +23,7 @@ fail=0 ok=0 timeout=0 PGSOCKET_DIR=/tmp +POOLING_MODE=classic CRED=$(tput setaf 1) CGREEN=$(tput setaf 2) @@ -114,6 +115,7 @@ function export_env_vars export PGSOCKET_DIR=$PGSOCKET_DIR export PGVERSION=`$PGBIN/initdb -V|awk '{print $3}'|sed 's/\..*//'` export LANG=C + export POOLING_MODE=$POOLING_MODE export ENABLE_TEST=true } @@ -128,6 +130,7 @@ function print_info echo "PostgreSQL Major version : "${CBLUE}$PGVERSION${CNORM} echo "pgbench : "${CBLUE}$PGBENCH_PATH${CNORM} echo "PostgreSQL jdbc : "${CBLUE}$JDBC_DRIVER${CNORM} + echo "Connection Pooling Mode : "${CBLUE}$POOLING_MODE${CNORM} echo ${CBLUE}"*************************"${CNORM} } @@ -143,8 +146,10 @@ function print_usage printf " -j FILE Postgres jdbc jar file path\n" >&2 printf " -s DIRECTORY unix socket directory\n" >&2 printf " -t TIMEOUT timeout value for each test (sec)\n" >&2 + printf " -P POOLING_MODE pooling mode for pgpool [classic|global] Default:$POOLING_MODE\n" >&2 printf " -c test pgpool using sample scripts and config files\n" >&2 printf " -d start pgpool with debug option\n" >&2 + printf " -v enable verbose log messages for pgpool\n" >&2 printf " -? print this help and then exit\n\n" >&2 printf "Please read the README for details on adding new tests\n" >&2 @@ -152,10 +157,11 @@ function print_usage trap "echo ; exit 0" SIGINT SIGQUIT -while getopts "p:m:i:j:b:s:t:cd?" OPTION +while getopts "P:p:m:i:j:b:s:t:cdv?" OPTION do case $OPTION in p) PG_INSTALL_DIR="$OPTARG";; + P) POOLING_MODE="$OPTARG";; m) MODE="$OPTARG";; i) PGPOOL_PATH="$OPTARG";; j) JDBC_DRIVER="$OPTARG";; @@ -163,6 +169,7 @@ do s) PGSOCKET_DIR="$OPTARG";; t) TIMEOUT="$OPTARG";; c) export TEST_SAMPLES="true";; + v) export POOL_VERBOSE_OUTPUT="true";; d) export PGPOOLDEBUG="true";; ?) print_usage exit 2;; @@ -185,6 +192,10 @@ else exit -1 fi +if [ "$POOLING_MODE" != "global" ] && [ "$POOLING_MODE" != "classic" ]; then + echo $POOLING_MODE : Invalid pooling mode. Valid values are global/classic + exit -1 +fi verify_pginstallation export_env_vars print_info -- 2.39.3 (Apple Git-146)