[Improvement]: Improve Ballerina transactions with XA Resource connection check/refresh before commit, rollback operations #41933
Labels
Team/CompilerFE
All issues related to Language implementation and Compiler, this exclude run times.
Type/Improvement
Description
XAResource is actually a connection to the back-end-resource (such as JDBC or JMS) and this connection needs to stay open during transactions as this connection is regularly used within a 2PC transaction. This connection can break due to network timeouts, failures and the back-end server crashes. A mechanism to check whether the connection is active and if not then re-establish the connection before commit, rollback operations can minimize transaction failures.
Describe your problem(s)
In Ballerina Transactions, the current implementation lacks a check for an active connection to a XA Resource before the prepare, commit/rollback calls. If a network failure, network timeout or a backend crash interrupts the connection between the application program and the XA Resource prior to commit/rollback operations, these calls on the XA Resource would proceed without validating the connection status leaving transactions in hazard states.
Describe your solution(s)
The proposed solution involves implementing a mechanism to check and refresh XA Resource connection if needed within Ballerina Transactions. This will serve as a preemptive check to verify the status of the XA Resource connection before the commit, rollback operations. If any connection is found to be broken or unstable, this will ensure that the connection is re-established before initiating the commit, thereby ensuring the transaction's integrity, minimizing transaction failures caused by connection failures.
Related area
-> Runtime
Related issue(s) (optional)
No response
Suggested label(s) (optional)
No response
Suggested assignee(s) (optional)
No response
The text was updated successfully, but these errors were encountered: