You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
The text was updated successfully, but these errors were encountered:
jmfinelli
added a commit
to jmfinelli/pgjdbc
that referenced
this issue
Mar 6, 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
) fromorg.postgresql.xa.PGXAConnection.rollback(Xid)
whenstmt.executeUpdate("ROLLBACK PREPARED '" + s + "'");
fails because of a constraint violation (which happened duringprepare
). In fact, when the driver returnsXA_RBINTEGRITY
from this method (which is invoked from this prepare's catch block), I guess thatcommittedOrRolledBack
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 returnXAER_NOTA
whenstmt.executeUpdate("ROLLBACK PREPARED '" + s + "'");
fails because there is no transaction with the specified Xid.The text was updated successfully, but these errors were encountered: