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

Aurora does not randomise selection of read replicas

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 1.5.4, 1.5.5
    • 1.5.6
    • Failover
    • None
    • Windows/Linux

    Description

      Given an Aurora cluster of one master and 2 read replicas, when creating a connection using Maria Connector/J and passing the master endpoint as URL, the connector will make one connection to the master and only ever connect to one of the read replicas, rather than randomly selecting one for load balancing.

      The documentation suggests that random picking connection initialization is the default for Aurora:
      https://mariadb.com/kb/en/mariadb/failover-and-high-availability-with-mariadb-connector-j/

      Root cause:
      It seems that within the loop method of AuroraProtocol.java:167 the read replicas are added in the order obtained from querying INFORMATION_SCHEMA.REPLICA_HOST_STATUS from the master endpoint, which is not randomized.

      Potential fix:
      This can be fixed by either randomizing the order they are inserted in the loop method, or randomizing the order that they are initially queried (e.g. ordering by the REPLICA_LAG_IN_MILLISECONDS in the query in getCurrentEndpointIdentifiers in AuroraListener.java:252).

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            mattbreeze Matthew Breeze
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

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