[Pgpool-general] PgPool install, Part Deux
Tatsuo Ishii
ishii at sraoss.co.jp
Thu Jul 9 02:59:13 UTC 2009
> Okay, doing some more thinking of whwat you state here ... what about
> stuff like:
>
> CREATE TABLE test ( id serial, data text );
>
> IF there are two connections to the databases (through pgpoool) and both
> issue:
>
> INSERT INTO test ( data ) VALUES ( 'conn1' );
> INSERT INTO test ( data ) VALUES ( 'conn2' );
> INSERT INTO test ( data ) VALUES ( 'conn3' );
>
> at the same time ... is it possible that backend 1 will have:
>
> 1, conn1
> 2, conn2
> 3, conn3
>
> while backend 2 has:
>
> 1, conn2
> 2, conn1
> 3, conn3
>
> Or does pgpool pass them back sequentially so that both sides will have it
> in the same order?
>
> Basically, with your example, it is easy to see how now() could be a
> problem, as if there is a slight delay on backend2 over backend1, the
> dates could / would drift some ... but what about stuff like serial keys?
>
> Tatsuo?
As of pgpool-II 2.2 or higher, pgpool autmatically issues LOCK TABLE
when you try to execute INSERT against a table which has SERIAL column
to avoid the situation you pointed out if "insert_lock" directive in
pgpool.conf is true.
You could observe the LOCK TABLE command generated by pgpool by
looking at PostgreSQL query log.
--
Tatsuo Ishii
SRA OSS, Inc. Japan
More information about the Pgpool-general
mailing list