[pgpool-hackers: 265] pgpool-II testing environment

Tatsuo Ishii ishii at postgresql.org
Thu May 30 18:09:46 JST 2013


Hi pgpool hackers,

Here is my sample script for regression test using pgpool_setup, which
is recently committed into master branch.
The script tests the bug reported in [pgpool-general: 1684].
Without commit:
http://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=c6ccf1e070f2e37878082fdfe40112b7f11a9197
The script just hungs.

The bug was introduced in 3.2.1. If I had the test script, I had
noticed the regression much earylier. So I believe it is important to
collect this kind of test scripts.
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese: http://www.sraoss.co.jp
-------------- next part --------------
#! /bin/sh
#-------------------------------------------------------------------
# test script for bug reported in [pgpool-general: 1684].
# The bug occurs when all of conditions below are met:
# - replication mode
# - pgpool_catalog.insert_lock is created
# - extended protocol is used
#
# DBD:Pg is required.
WHOAMI=`whoami`

mkdir test.insert_lock
cd test.insert_lock
# create test environment
echo -n "creating test environment..."
sh $HOME/bin/pgpool_setup -m r -n 1 || exit 1
echo "done."

./bashrc.ports

sh startall
sleep 10

# create insert_lock table

psql -p $PGPOOL_PORT test <<EOF
DROP TABLE IF EXISTS pgpool_catalog.insert_lock;
CREATE SCHEMA pgpool_catalog;
CREATE TABLE pgpool_catalog.insert_lock(reloid OID PRIMARY KEY);
 
-- this row is used as the row lock target when pgpool inserts new oid
INSERT INTO pgpool_catalog.insert_lock VALUES (0);

-- allow "SELECT ... FOR UPDATE" and "INSERT ..." to all roles
GRANT SELECT ON pgpool_catalog.insert_lock TO PUBLIC;
GRANT UPDATE ON pgpool_catalog.insert_lock TO PUBLIC;
GRANT INSERT ON pgpool_catalog.insert_lock TO PUBLIC;
EOF

# create test table

psql -p $PGPOOL_PORT test <<EOF
DROP TABLE IF EXISTS kd_test_serial_pgpool;
CREATE TABLE kd_test_serial_pgpool(id SERIAL, content TEXT);
EOF

echo -n "run test perl script to see if it hungs..."
perl <<EOF
use strict;
use DBI;
my \$dbh;
my \$sth;
\$dbh = DBI->connect("DBI:Pg:dbname=test;host=localhost;port=$PGPOOL_PORT","$WHOAMI",'');
if (\$dbh)
{
  \$sth = \$dbh->prepare("insert into kd_test_serial_pgpool(content)values (?)");      # hangs
  \$sth->execute('perl lkhzfjktfjktf');
  \$sth->finish;
}
\$dbh->disconnect();
EOF

echo "ok."

sh shutdownall


More information about the pgpool-hackers mailing list