[Pgcluster-general] code to reproduce replication server hanging

Hans-Juergen Schoenig postgres at cybertec.at
Wed Jul 18 05:37:41 UTC 2007


hello ...

we fixed a couple of those problems in our replication engine (which  
has to a great extend been rewritten). One of the major problems is  
the locking code here. check for pending locks in the backend. if i  
remember correctly it had to do with the FOR SHARE LOCK pgcluster is  
setting internally in some code path (the codes should be easy to find).
unfortunately i don't have a patch at hand as we significantly  
changed those code paths.

	best regards,

		hans


On Jul 17, 2007, at 5:22 PM, Dmitry Deniskin wrote:

> 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
>
> <replicator_log.txt>
> <cluster_configs.txt>
> <code.txt>
> <node1_log.txt>
> <node2_log.txt>
> _______________________________________________
> Pgcluster-general mailing list
> Pgcluster-general at pgfoundry.org
> http://pgfoundry.org/mailman/listinfo/pgcluster-general



--
Cybertec Geschwinde & Schönig GmbH
Gröhrmühlgasse 26, 2700 Wiener Neustadt
Tel: +43/1/205 10 35 / 340
www.postgresql.at, www.cybertec.at


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://pgfoundry.org/pipermail/pgcluster-general/attachments/20070718/ff469dcf/attachment.html 


More information about the Pgcluster-general mailing list