Details
-
Bug
-
Status: In Progress (View Workflow)
-
Critical
-
Resolution: Unresolved
-
3.5.6, 3.5.7
-
None
Description
When two XA connections are created with different rewriteBatchedStatements settings, isSameRM() incorrectly returns true. This causes transaction managers to use XA START ... JOIN on the second connection, resulting in an
exception.
Test case:
String URL1 = "jdbc:mariadb://localhost:3306/testj";
String URL2 = "jdbc:mariadb://localhost:3306/testj?rewriteBatchedStatements=true";
MariaDbDataSource ds1 = new MariaDbDataSource();
ds1.setUrl(URL1);
ds1.setUser("root");
MariaDbDataSource ds2 = new MariaDbDataSource();
ds2.setUrl(URL2);
ds2.setUser("root");
XAConnection xaConn1 = ds1.getXAConnection();
XAConnection xaConn2 = ds2.getXAConnection();
XAResource xaRes1 = xaConn1.getXAResource();
XAResource xaRes2 = xaConn2.getXAResource();
// Returns true, should return false
System.out.println("isSameRM: " + xaRes1.isSameRM(xaRes2));
Root cause:
The rewriteBatchedStatements property is missing from the toBuilder() method in Configuration.java. This method is used when comparing configurations, so two connections with different rewriteBatchedStatements values appear
identical.
Proposed fix:
In Configuration.java, add .rewriteBatchedStatements(this.rewriteBatchedStatements) in the toBuilder() method between .allowLocalInfile(this.allowLocalInfile) and .useCompression(this.useCompression).