Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-1305

XAResource.isSameRM() incorrectly returns true when rewriteBatchedStatements differs between connections

    XMLWordPrintable

Details

    • Bug
    • Status: In Progress (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 3.5.6, 3.5.7
    • 3.5.8
    • XA
    • 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).

      Related: CONJ-1238, CONJ-1283, CONJ-1299

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            claudio.nanni Claudio Nanni
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.