[Pgcluster-general] code to reproduce replication server hanging
Dmitry Deniskin
reggiman at yandex.ru
Tue Jul 17 15:22:29 UTC 2007
Hello,
We use 2 database nodes and 1 replication server.
Simpliest test code running simultaneously on the both
nodes hangs the replicator.
Production enviroment:
- Debian Etch 4.0r0 i386
- PgCluster v.1.7.0rc7
I've enclosed logs from node1, node2 and replicator
and cluster configuration files.
I'd very appreciate any help!
start command for node1:
sudo -u postgres /usr/local/pgsql/bin/pg_ctl start -D /usr/local/pgsql/data -l /usr/local/pgsql/log/cluster.log
start command for other nodes:
sudo -u postgres /usr/local/pgsql/bin/pg_ctl start -D /usr/local/pgsql/data -o "-R" -l /usr/local/pgsql/log/cluster.log
start command for replicator:
sudo -u postgres /usr/local/pgsql/bin/pgreplicate -D /usr/local/pgsql/etc
Here the simple code which hangs the replication server.
==========================================================================
$conn_string = "host=localhost port=5432 dbname=ourdomain user=ourdomain
password=ourdomain";
$conn = pg_pconnect($conn_string);
if(!$conn) {
echo "Connection failed.";
return;
}
//$sql_test_table = "CREATE TABLE pg_test(data text)";
//pg_query($sql_test_table);
$CYCLES = 1000;
$sql_sel = 'SELECT * FROM pg_test WHERE data = $1 FOR UPDATE';
$sql_ins_tpl = "INSERT INTO pg_test (data) VALUES ($1)";
for($i = 0; $i < $CYCLES; ++$i) {
echo '.';
if(!($i % 100))
echo " $i ";
pg_query("begin");
pg_query_params($sql_sel,array("1"));
pg_query_params($sql_ins_tpl,array(mt_rand(0,time())));
pg_query("commit");
}
pg_close($conn);
==========================================================================
--
Dmitry
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: replicator_log.txt
Url: http://pgfoundry.org/pipermail/pgcluster-general/attachments/20070717/2563d83e/attachment-0005.txt
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cluster_configs.txt
Url: http://pgfoundry.org/pipermail/pgcluster-general/attachments/20070717/2563d83e/attachment-0006.txt
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: code.txt
Url: http://pgfoundry.org/pipermail/pgcluster-general/attachments/20070717/2563d83e/attachment-0007.txt
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: node1_log.txt
Url: http://pgfoundry.org/pipermail/pgcluster-general/attachments/20070717/2563d83e/attachment-0008.txt
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: node2_log.txt
Url: http://pgfoundry.org/pipermail/pgcluster-general/attachments/20070717/2563d83e/attachment-0009.txt
More information about the Pgcluster-general
mailing list