New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect return code for error on call of commit during 2PC #236

Closed
ochaloup opened this Issue Dec 10, 2014 · 4 comments

Comments

Projects
None yet
3 participants
@ochaloup
Contributor

ochaloup commented Dec 10, 2014

PostgreSQL jdbc driver returns incorrect code during on call of commit during 2PC. Currently the driver returns XAER_RMERR.
I expect that it's this call
https://github.com/pgjdbc/pgjdbc/blob/master/org/postgresql/xa/PGXAConnection.java#L528

But the XA spec (http://pubs.opengroup.org/onlinepubs/009680699/toc.pdf) says for XAER_RMERR that
"An error occurred in committing the work performed on behalf of the transaction
branch and the branch’s work has been rolled back. Note that returning this error
signals a catastrophic event to a transaction manager since other resource
managers may successfully commit their work on behalf of this branch. This error
should be returned only when a resource manager concludes that it can never
commit the branch and that it cannot hold the branch’s resources in a prepared
state. Otherwise, [XA_RETRY] should be returned."

In case there is longer discussion about scenario hitting this issue and about handling this at RedHat bugzilla here:
https://bugzilla.redhat.com/show_bug.cgi?id=988724

From what is said here I think that PostgreSQL database should rollback the transaction itself and then it could return XAException error code XAER_RMERR or it should return
XAER_RMFAIL or XAER_RETRY.

@whitingjr

This comment has been minimized.

Show comment
Hide comment
@whitingjr

whitingjr Nov 30, 2015

Contributor

This was fixed in PR #78.

Contributor

whitingjr commented Nov 30, 2015

This was fixed in PR #78.

@ochaloup

This comment has been minimized.

Show comment
Hide comment
@ochaloup

ochaloup Nov 30, 2015

Contributor

Hi @whitingjr,

I'm sorry that could be easily my fault but I can't see the connection between PR#78 and this reported bug. What I can see the PR#78 (dc44225) changes the way how distinguish throwing XAER_NOTA but this issue is about returning XAER_RETRY or FAIL instead of XAER_RMERR.

ondra

Contributor

ochaloup commented Nov 30, 2015

Hi @whitingjr,

I'm sorry that could be easily my fault but I can't see the connection between PR#78 and this reported bug. What I can see the PR#78 (dc44225) changes the way how distinguish throwing XAER_NOTA but this issue is about returning XAER_RETRY or FAIL instead of XAER_RMERR.

ondra

ochaloup added a commit to ochaloup/pgjdbc that referenced this issue Mar 14, 2017

ochaloup added a commit to ochaloup/pgjdbc that referenced this issue Mar 14, 2017

ochaloup added a commit to ochaloup/pgjdbc that referenced this issue Mar 15, 2017

Adjusting incorrect XAException return codes
This commit fixes error codes which are thrown from PostgreSQL
XAResource jdbc driver to comply better with xa specification.

There are three main adjustments
* XAException.XAER_RMFAIL is used when some connection error happens
  and it is expected that reconnection of RM could occur
* XAException.XAER_NOTA is used when RM does not know anything about the
  provided Xid
* XAException.XAER_PROTO is used when some wrong sequence of method
  calls is invoked

This addresses issues
pgjdbc#236
pgjdbc#510
pgjdbc#683

lucesape added a commit to Spirals-Team/librepair-experiments that referenced this issue Mar 15, 2017

Adjusting incorrect XAException return codes
This commit fixes error codes which are thrown from PostgreSQL
XAResource jdbc driver to comply better with xa specification.

There are three main adjustments
* XAException.XAER_RMFAIL is used when some connection error happens
  and it is expected that reconnection of RM could occur
* XAException.XAER_NOTA is used when RM does not know anything about the
  provided Xid
* XAException.XAER_PROTO is used when some wrong sequence of method
  calls is invoked

This addresses issues
pgjdbc/pgjdbc#236
pgjdbc/pgjdbc#510
pgjdbc/pgjdbc#683

ochaloup added a commit to ochaloup/pgjdbc that referenced this issue Mar 21, 2017

Adjusting incorrect XAException return codes
This commit fixes error codes which are thrown from PostgreSQL
XAResource jdbc driver to comply better with xa specification.

There are three main adjustments
* XAException.XAER_RMFAIL is used when some connection error happens
  and it is expected that reconnection of RM could occur
* XAException.XAER_NOTA is used when RM does not know anything about the
  provided Xid
* XAException.XAER_PROTO is used when some wrong sequence of method
  calls is invoked

This addresses issues
pgjdbc#236
pgjdbc#510
pgjdbc#683

lucesape added a commit to surli/librepair-XP that referenced this issue Apr 6, 2017

Adjusting incorrect XAException return codes
This commit fixes error codes which are thrown from PostgreSQL
XAResource jdbc driver to comply better with xa specification.

There are three main adjustments
* XAException.XAER_RMFAIL is used when some connection error happens
  and it is expected that reconnection of RM could occur
* XAException.XAER_NOTA is used when RM does not know anything about the
  provided Xid
* XAException.XAER_PROTO is used when some wrong sequence of method
  calls is invoked

This addresses issues
pgjdbc/pgjdbc#236
pgjdbc/pgjdbc#510
pgjdbc/pgjdbc#683
@whitingjr

This comment has been minimized.

Show comment
Hide comment
@whitingjr

whitingjr Jan 5, 2018

Contributor

@ochaloup your absolutely right. please disregard the comment.

Contributor

whitingjr commented Jan 5, 2018

@ochaloup your absolutely right. please disregard the comment.

@ochaloup

This comment has been minimized.

Show comment
Hide comment
@ochaloup

ochaloup Jan 5, 2018

Contributor

@whitingjr ok, I haven't received your previous comment :) I have this issue in mind still but I haven't got time to properly test my proposal changes. Huh, unfortunately :/

Contributor

ochaloup commented Jan 5, 2018

@whitingjr ok, I haven't received your previous comment :) I have this issue in mind still but I haven't got time to properly test my proposal changes. Huh, unfortunately :/

ochaloup added a commit to ochaloup/pgjdbc that referenced this issue Jan 6, 2018

Adjusting incorrect XAException return codes
This commit fixes error codes which are thrown from PostgreSQL
XAResource jdbc driver to comply better with xa specification.

There are three main adjustments
* XAException.XAER_RMFAIL is used when some connection error happens
  and it is expected that reconnection of RM could occur
* XAException.XAER_NOTA is used when RM does not know anything about the
  provided Xid
* XAException.XAER_PROTO is used when some wrong sequence of method
  calls is invoked

This addresses issues
pgjdbc#236
pgjdbc#510
pgjdbc#683

ochaloup added a commit to ochaloup/pgjdbc that referenced this issue Jan 25, 2018

Adjusting incorrect XAException return codes
This commit fixes error codes which are thrown from PostgreSQL
XAResource jdbc driver to comply better with xa specification.

There are three main adjustments
* XAException.XAER_RMFAIL is used when some connection error happens
  and it is expected that reconnection of RM could occur
* XAException.XAER_NOTA is used when RM does not know anything about the
  provided Xid
* XAException.XAER_PROTO is used when some wrong sequence of method
  calls is invoked

This addresses issues
pgjdbc#236
pgjdbc#510
pgjdbc#683

ochaloup added a commit to ochaloup/pgjdbc that referenced this issue Jan 27, 2018

Adjusting incorrect XAException return codes
This commit fixes error codes which are thrown from PostgreSQL
XAResource jdbc driver to comply better with xa specification.

There are three main adjustments
* XAException.XAER_RMFAIL is used when some connection error happens
  and it is expected that reconnection of RM could occur
* XAException.XAER_NOTA is used when RM does not know anything about the
  provided Xid
* XAException.XAER_PROTO is used when some wrong sequence of method
  calls is invoked

This addresses issues
pgjdbc#236
pgjdbc#510
pgjdbc#683

ochaloup added a commit to ochaloup/pgjdbc that referenced this issue Feb 19, 2018

Adjusting incorrect XAException return codes
This commit fixes error codes which are thrown from PostgreSQL
XAResource jdbc driver to comply better with xa specification.

There are three main adjustments
* XAException.XAER_RMFAIL is used when some connection error happens
  and it is expected that reconnection of RM could occur
* XAException.XAER_NOTA is used when RM does not know anything about the
  provided Xid
* XAException.XAER_PROTO is used when some wrong sequence of method
  calls is invoked

This addresses issues
pgjdbc#236
pgjdbc#510
pgjdbc#683

vlsi added a commit to ochaloup/pgjdbc that referenced this issue Mar 11, 2018

Adjusting incorrect XAException return codes
This commit fixes error codes which are thrown from PostgreSQL
XAResource jdbc driver to comply better with xa specification.

There are three main adjustments
* XAException.XAER_RMFAIL is used when some connection error happens
  and it is expected that reconnection of RM could occur
* XAException.XAER_NOTA is used when RM does not know anything about the
  provided Xid
* XAException.XAER_PROTO is used when some wrong sequence of method
  calls is invoked

This addresses issues
pgjdbc#236
pgjdbc#510
pgjdbc#683

@vlsi vlsi added this to the 42.2.2 milestone Mar 11, 2018

@vlsi vlsi closed this in e5aab1c Mar 11, 2018

rhavermans added a commit to bolcom/pgjdbc that referenced this issue Jul 13, 2018

Adjust XAException return codes for better compatibility with XA spec…
…ification (pgjdbc#782)

There are three main adjustments
* XAException.XAER_RMFAIL is used when some connection error happens
  and it is expected that reconnection of RM could occur
* XAException.XAER_NOTA is used when RM does not know anything about the
  provided Xid
* XAException.XAER_PROTO is used when some wrong sequence of method
  calls is invoked

Fixes pgjdbc#236, pgjdbc#510, pgjdbc#683

rhavermans added a commit to bolcom/pgjdbc that referenced this issue Jul 13, 2018

Adjust XAException return codes for better compatibility with XA spec…
…ification (pgjdbc#782)

There are three main adjustments
* XAException.XAER_RMFAIL is used when some connection error happens
  and it is expected that reconnection of RM could occur
* XAException.XAER_NOTA is used when RM does not know anything about the
  provided Xid
* XAException.XAER_PROTO is used when some wrong sequence of method
  calls is invoked

Fixes pgjdbc#236, pgjdbc#510, pgjdbc#683
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment