Skip to content
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

org.postgresql.xa.PGXAConnection.rollback(Xid) should return XAER_NOTA #3153

Open
jmfinelli opened this issue Mar 5, 2024 · 0 comments
Open

Comments

@jmfinelli
Copy link

jmfinelli commented Mar 5, 2024

Describe the issue

This issue is a possible misalignment of pgjdbc from the XA specification.

A user of the Narayana community reported that Narayana is invoking rollback even when it is not needed. That report made me realise that, even though it is true that Narayana shouldn't invoke rollback in some cases, pgjdbc is probably not returning the right XAException error code (i.e. XAER_NOTA) from org.postgresql.xa.PGXAConnection.rollback(Xid) when stmt.executeUpdate("ROLLBACK PREPARED '" + s + "'"); fails because of a constraint violation (which happened during prepare). In fact, when the driver returns XA_RBINTEGRITY from this method (which is invoked from this prepare's catch block), I guess that committedOrRolledBack should be also set to true.

Driver Version?
42.6.0

Java Version?
JDK 11

OS Version?
Fedora Linux 38

PostgreSQL Version?
16.2-1

To Reproduce
This is the link to the reproducer of the Narayana community's user that fully demonstrates the issue.

Expected behaviour
org.postgresql.xa.PGXAConnection.rollback(Xid) should return XAER_NOTA when stmt.executeUpdate("ROLLBACK PREPARED '" + s + "'"); fails because there is no transaction with the specified Xid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant