[pgpool-general: 4188] Re: documentation bug?

Yugo Nagata nagata at sraoss.co.jp
Thu Nov 12 08:19:28 JST 2015


On Tue, 10 Nov 2015 12:34:26 -0500
Pablo Sanchez <pablo at blueoakdb.com> wrote:

Hi Pablo,

> [ Comments below, in-line ]
> 
> 
> On 11/10/2015 12:14 AM, Yugo Nagata wrote:
> > Hi Pablo,
> 
> Hi Yugo,
> 
> > On Mon, 9 Nov 2015 15:35:33 -0500
> > Pablo Sanchez <pablo at blueoakdb.com> wrote:
> >
> >>
> >> I believe the documentation should read TRUE, not FALSE.
> >
> > Do you mean the correct statement is:
> >
> > "when the JDBC driver's 'autocommit' option is set to **TRUE**,
> > it wraps all queries around a 'BEGIN' and 'COMMIT"?
> >
> > This is wrong.  When autocommit is true, the query is sent without BEGIN
> > and committed implicitly if this isn't in a transaction block.[1][2]
> >
> > [1] http://www.postgresql.org/docs/9.4/static/sql-begin.htm
> > [2] https://docs.oracle.com/javase/tutorial/jdbc/basics/transactions.html#disable_auto_commit
> 
>  From [2] it states 'The way to allow two or more statements to be
> grouped into a transaction is to disable the auto-commit mode.'
> 
> It provides the example of setting the property to *FALSE* to
> accomplish this ability.
> 
> Below is the excerpt from the manual:
> 
>     The way to allow two or more statements to be grouped into a
>     transaction is to disable the auto-commit mode. This is
>     demonstrated in the following code, where con is an active
>     connection:
> 
>     con.setAutoCommit(false);
> 

This means that when autocommit is false (disabled), two or more
statements can be grouped into a transaction because "START TRANSACTION" 
(which is same as BEGIN in PostgreSQL) is issued by JDBC before sending
the first query, and COMMIT is sent when con.commit() is executed.

Otherwise when autocomit is true, queries are sent directly without
BEGIN or COMMIT.

> To me this means this PGPool text should be written ...
> 
> ::: From :::
> http://www.pgpool.net/docs/latest/pgpool-en.html#condition_for_load_balance
> 
> Note: the JDBC driver has an autocommit option. If the autocommit is
>        *false*, the JDBC driver sends "BEGIN" and "COMMIT" by itself. In 
> this
>        case the same restriction above regarding load balancing will be
>        applied.

This is right. If autocommit = false, JDBC driver sends BEGIN when the first
query is issued and COMMIT when con.commit() is executed. Until commit(), 
queries are NOT committed automatically.

> 
> ::: To :::
> 
> Note: the JDBC driver has an autocommit option. If the autocommit is
>        *true*, the JDBC driver sends "BEGIN" and "COMMIT" by itself. In this
>        case the same restriction above regarding load balancing will be
>        applied.

Wrong. if autocommit is true, JDBC driver doesn't send BEGIN or COMMIT,
so issued query is commited automatically.

> 
> Cheers,
> --
> Pablo Sanchez - Blueoak Database Engineering, Inc
> Ph:    819.459.1926         Blog:  http://pablo-blog.blueoakdb.com
> iNum:  883.5100.0990.1054


-- 
Yugo Nagata <nagata at sraoss.co.jp>


More information about the pgpool-general mailing list