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

Failed to connect to Aurora cluster when "createDatabaseIfNotExist=true" option has specified

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.2.1
    • Fix Version/s: None
    • Component/s: aurora, Failover
    • Labels:
      None

      Description

      Failed to connect to Aurora cluster configured by 2 nodes when I specified "createDatabaseIfNotExist=true" option to the JDBC URL.
      1 node in the cluster ... Success
      2 nodes in the cluster ... Fail

      My JDBC URL was

      jdbc:mysql:aurora://*-cluster.cluster-*.rds.amazonaws.com:3306/*?createDatabaseIfNotExist=true
      

      After I removed "createDatabaseIfNotExist=true", it succeeded to connect even if there are 2 nodes.

      A part of stack trace

      Caused by: java.sql.SQLException: Communications link failure with primary. No active connection found for replica. 
      	at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:179)
      	at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:118)
      	at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.throwException(ExceptionMapper.java:92)
      	at org.mariadb.jdbc.Driver.connect(Driver.java:111)
      	at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:117)
      	at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:123)
      	at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:375)
      	at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:204)
      	at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:459)
      	at com.zaxxer.hikari.pool.HikariPool.access$200(HikariPool.java:70)
      	at com.zaxxer.hikari.pool.HikariPool$PoolEntryCreator.call(HikariPool.java:696)
      	at com.zaxxer.hikari.pool.HikariPool$PoolEntryCreator.call(HikariPool.java:682)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	... 1 common frames omitted
      Caused by: java.sql.SQLException: Communications link failure with primary. No active connection found for replica. 
      	at org.mariadb.jdbc.internal.failover.AbstractMastersListener.throwFailoverMessage(AbstractMastersListener.java:470)
      	at org.mariadb.jdbc.internal.failover.impl.MastersSlavesListener.checkInitialConnection(MastersSlavesListener.java:173)
      	at org.mariadb.jdbc.internal.failover.impl.MastersSlavesListener.initializeConnection(MastersSlavesListener.java:160)
      	at org.mariadb.jdbc.internal.failover.FailoverProxy.<init>(FailoverProxy.java:97)
      	at org.mariadb.jdbc.internal.util.Utils.retrieveProxy(Utils.java:466)
      	at org.mariadb.jdbc.Driver.connect(Driver.java:106)
      	... 12 common frames omitted
      Caused by: java.sql.SQLException: The MySQL server is running with the --read-only option so it cannot execute this statement
      	at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.readErrorPacket(AbstractQueryProtocol.java:1193)
      	at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.readPacket(AbstractQueryProtocol.java:1065)
      	at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.getResult(AbstractQueryProtocol.java:1028)
      	at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.additionalData(AbstractConnectProtocol.java:624)
      	at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connect(AbstractConnectProtocol.java:429)
      	at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connect(AbstractConnectProtocol.java:364)
      	at org.mariadb.jdbc.internal.protocol.AuroraProtocol.loop(AuroraProtocol.java:152)
      	at org.mariadb.jdbc.internal.failover.impl.AuroraListener.reconnectFailedConnection(AuroraListener.java:185)
      	at org.mariadb.jdbc.internal.failover.impl.MastersSlavesListener.initializeConnection(MastersSlavesListener.java:157)
      	... 15 common frames omitted
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              diego dupin Diego Dupin
              Reporter:
              yasuyuki.baba Yasuyuki Baba
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: