From: | joël Winteregg <joel(dot)winteregg(at)gmail(dot)com> |
---|---|
To: | Heikki Linnakangas <heikki(at)enterprisedb(dot)com> |
Cc: | pgsql-jdbc(at)postgresql(dot)org, Ludovic Orban <ludovic(dot)orban(at)gmail(dot)com> |
Subject: | Re: XAResource implementation |
Date: | 2007-11-13 20:23:31 |
Message-ID: | 1194985411.5533.6.camel@hatman |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Hello Heikki,
Many thanks for these informations !
> Patch attached. I also added a test for this in the test suite.
Really cool !
> Can you check that this fixes the issue for you, please? I can send you
> a patched jar if you don't have build environment, let me know if you
> need it.
Yes, that would be great (easier) to have it as a patched jar. Then, I will provide you a feedback about its behavior in my application...
Many many thanks for your support !
Joël
On Tue, 2007-11-13 at 16:51 +0000, Heikki Linnakangas wrote:
> joël Winteregg wrote:
> > Many thanks for your answer and for the time you took to do some
> > testing ! As you can see I put Ludovic Orban as Cc because he is the BTM
> > developer and he seems to be interested to this issue too...
> >
> >> Hmm. I downloaded the BTM newUserDemo.zip and modified it to run with
> >> Postgres, and to run two queries in same transaction. Works for me.
> >>
> >
> > Ah Yes, you're right, your transaction just looks perfect !
> >
> >> Attached is the modified Test.java I used. To run:
> >> 0. Download newUserDemo.zip from
> >> http://docs.codehaus.org/display/BTM/NewUserGuide
> >> 1. Put postgresql.jar in newUserDemo/lib
> >> 2. Copy the attached Test.java to newUserDemo/src/jtatest
> >> 3. Modify database/username/password in Test.java if necessary
> >> 4. Run the CREATE TABLE from derby-create.sql
> >>
> >> Here's what I get in the Postgres log, with log_statements='all':
> >>
> >> LOG: execute <unnamed>: SELECT gid FROM pg_prepared_xacts
> >> LOG: execute S_1: BEGIN
> >> LOG: execute <unnamed>: insert into messages(content) values ($1)
> >> DETAIL: parameters: $1 = 'hello, world!'
> >> LOG: execute S_2: COMMIT
> >> LOG: execute S_1: BEGIN
> >> LOG: execute <unnamed>: select content from messages
> >> LOG: execute <unnamed>: select content from messages
> >> LOG: execute S_2: COMMIT
> >
> > On my side, I tryed the following example:
> > http://docs.codehaus.org/download/attachments/9240687/HibernateBTM.zip?version=2
>
> Ok, I downloaded and installed that as well, and saw similar results.
>
> It looks like there is indeed a bug in the Postgres driver. I believe it
> was introduced by the recent changes to keep the connection in
> autocommit mode when no XA-transaction is in progress.
>
> It's this call sequence that borks it up:
>
> xares.start()
> conn = xares.getConnection()
> // do stuff
> conn.close();
> conn = xares.getConnection()
> // do more stuff
> xares.end()
> xares.commit()
>
> The 2nd getConnection call inadvertently commits the transaction, and
> opens another one.
>
> Patch attached. I also added a test for this in the test suite.
>
> Can you check that this fixes the issue for you, please? I can send you
> a patched jar if you don't have build environment, let me know if you
> need it.
>
From | Date | Subject | |
---|---|---|---|
Next Message | Kris Jurka | 2007-11-13 20:42:57 | Re: XAResource implementation |
Previous Message | Kris Jurka | 2007-11-13 18:06:22 | Re: XAResource implementation |