Thread: Re: [BUGS] Incorrect response code after XA recovery

Re: [BUGS] Incorrect response code after XA recovery

From
Tom Lane
Date:
Tom Jenkinson <tom.jenkinson@redhat.com> writes:
> On Mon 29 Jul 2013 15:46:12 BST, Tom Lane wrote:
>> No idea, but in any case that's outside Postgres' purview.  It's barely
>> possible that the Postgres JDBC driver has something to do with that,
>> but it sounds more like the XA manager's turf.

> I am not sure what you mean here as I don't know the structure of how
> the PostGres project is packaged, all I know is that the PostGres JDBC
> driver component appears to be returning an XAException with the
> message "Error rolling back prepared transaction" and an errorCode of
> XAException.XAER_RMERR rather than XAER_NOTA.

> Is there a different component within your bug tracking system  we
> should be using to raise this against the JDBC driver instead?

The folk who would fix anything in the JDBC driver tend to read
pgsql-jdbc sooner than pgsql-bugs, so cc'ing there for comment.

            regards, tom lane


Re: [BUGS] Incorrect response code after XA recovery

From
Jeremy Whiting
Date:
Hi Tom,
 The driver currently doesn't report back to the calling client (tm)
XAException.XAER_NOTA code as Ondrej and Tom Jenkinson have identified.
Instead it returns XAException.XAER_RMERR. See line 416

https://github.com/pgjdbc/pgjdbc/blob/master/org/postgresql/xa/PGXAConnection.java#416

 which imo is used for general errors in the resource manager.

 I've written a test case that can be pulled into the pgjdbc testsuite
that will make verifying this error easier. It is based on the example
code Tom Jenkinson provided. A pull request has been created which can
be found here...

https://github.com/pgjdbc/pgjdbc/pull/73

 I am currently coding up a change to the driver in anticipation there
is agreement in the pgjdbc group to change the rollback method. Another
pull request will be created for that. Let's see what discussion and
decision is made by the more active members in pgjdbc.

Regards,
Jeremy

On 29/07/13 16:11, Tom Lane wrote:
> Tom Jenkinson <tom.jenkinson@redhat.com> writes:
>> On Mon 29 Jul 2013 15:46:12 BST, Tom Lane wrote:
>>> No idea, but in any case that's outside Postgres' purview.  It's barely
>>> possible that the Postgres JDBC driver has something to do with that,
>>> but it sounds more like the XA manager's turf.
>> I am not sure what you mean here as I don't know the structure of how
>> the PostGres project is packaged, all I know is that the PostGres JDBC
>> driver component appears to be returning an XAException with the
>> message "Error rolling back prepared transaction" and an errorCode of
>> XAException.XAER_RMERR rather than XAER_NOTA.
>> Is there a different component within your bug tracking system  we
>> should be using to raise this against the JDBC driver instead?
> The folk who would fix anything in the JDBC driver tend to read
> pgsql-jdbc sooner than pgsql-bugs, so cc'ing there for comment.
>
>             regards, tom lane
>
>




Re: [BUGS] Incorrect response code after XA recovery

From
Jeremy Whiting
Date:
Hi pgjdbc,
 The code change to fix the failing test case
(https://github.com/whitingjr/pgjdbc/tree/xa-not-found-testcase) is on
this branch...
https://github.com/whitingjr/pgjdbc/tree/handle-rollback-xid-not-found

 By checking the SQLException.SQLState field the driver will now throw
an exception using XAER_NOTA as the reason. The SQLState being 42704
("undefined_object") error code as listed in
http://www.postgresql.org/docs/9.2/static/errcodes-appendix.html

 Comments on the implementation are welcome though probably premature
because wider discussion has yet to happen for $subject.

Regards,
Jeremy

On 31/07/13 12:36, Jeremy Whiting wrote:
> Hi Tom,
>  The driver currently doesn't report back to the calling client (tm)
> XAException.XAER_NOTA code as Ondrej and Tom Jenkinson have identified.
> Instead it returns XAException.XAER_RMERR. See line 416
>
> https://github.com/pgjdbc/pgjdbc/blob/master/org/postgresql/xa/PGXAConnection.java#416
>
>  which imo is used for general errors in the resource manager.
>
>  I've written a test case that can be pulled into the pgjdbc testsuite
> that will make verifying this error easier. It is based on the example
> code Tom Jenkinson provided. A pull request has been created which can
> be found here...
>
> https://github.com/pgjdbc/pgjdbc/pull/73
>
>  I am currently coding up a change to the driver in anticipation there
> is agreement in the pgjdbc group to change the rollback method. Another
> pull request will be created for that. Let's see what discussion and
> decision is made by the more active members in pgjdbc.
>
> Regards,
> Jeremy
>
> On 29/07/13 16:11, Tom Lane wrote:
>> Tom Jenkinson <tom.jenkinson@redhat.com> writes:
>>> On Mon 29 Jul 2013 15:46:12 BST, Tom Lane wrote:
>>>> No idea, but in any case that's outside Postgres' purview.  It's barely
>>>> possible that the Postgres JDBC driver has something to do with that,
>>>> but it sounds more like the XA manager's turf.
>>> I am not sure what you mean here as I don't know the structure of how
>>> the PostGres project is packaged, all I know is that the PostGres JDBC
>>> driver component appears to be returning an XAException with the
>>> message "Error rolling back prepared transaction" and an errorCode of
>>> XAException.XAER_RMERR rather than XAER_NOTA.
>>> Is there a different component within your bug tracking system  we
>>> should be using to raise this against the JDBC driver instead?
>> The folk who would fix anything in the JDBC driver tend to read
>> pgsql-jdbc sooner than pgsql-bugs, so cc'ing there for comment.
>>
>>             regards, tom lane
>>
>>
>
>
>


--
Jeremy Whiting
Senior Software Engineer, Performance Team
Red Hat

------------------------------------------------------------
Registered Address: Red Hat UK Ltd, 64 Baker Street, 4th Floor, London. W1U 7DF. United Kingdom.
Registered in England and Wales under Company Registration No. 03798903. Directors: Michael Cunningham (USA), Mark
Hegarty(Ireland), Matt Parson (USA), Charlie Peters (USA)