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

Permit connection creation to allow execution of read-only statements on slaves when master is down

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.0
    • Fix Version/s: 2.2.0
    • Component/s: Failover
    • Labels:
      None

      Description

      Some users would like their application to be able to execute read-only statements on slaves even if the master is down. Unfortunately, MariaDB Connector/J does not currently seem to allow this. If the master is down, MariaDB Connector/J throws an exception saying that it failed to connect.

      Would it make sense to add an option that would allow the application to continue executing read-only queries when the master is down? Maybe it could be called "masterDownAllowReadOnly" or something?

      For an example of what I mean, please see the test program that I will attach to the issue. When running the program, I see the following output:

      [ec2-user@ip-172-30-0-249 ~]$ export CLASSPATH=/home/ec2-user/mariadb-java-client-2.1.0.jar:.
      [ec2-user@ip-172-30-0-249 ~]$ javac TestDriverFailoverNoMaster.java
      [ec2-user@ip-172-30-0-249 ~]$ java TestDriverFailoverNoMaster
      SQLException: Communications link failure with primary. No active connection found for master : Could not connect to HostAddress{host='nonexistent', port=3306, type='master'}. nonexistent.
      SQLState: 08
      VendorError: 0
      SQLException: Communications link failure with primary. No active connection found for master : Could not connect to HostAddress{host='nonexistent', port=3306, type='master'}. nonexistent.
      SQLState: 08
      VendorError: 0
      SQLException: Communications link failure with primary. No active connection found for master : Could not connect to HostAddress{host='nonexistent', port=3306, type='master'}. nonexistent.
      SQLState: 08
      VendorError: 0
      SQLException: Communications link failure with primary. No active connection found for master : Could not connect to HostAddress{host='nonexistent', port=3306, type='master'}. nonexistent.
      SQLState: 08
      VendorError: 0
      SQLException: Communications link failure with primary. No active connection found for master : Could not connect to HostAddress{host='nonexistent', port=3306, type='master'}. nonexistent.
      SQLState: 08
      VendorError: 0
      SQLException: Communications link failure with primary. No active connection found for master : Could not connect to HostAddress{host='nonexistent', port=3306, type='master'}. nonexistent.
      SQLState: 08
      VendorError: 0
      SQLException: Communications link failure with primary. No active connection found for master : Could not connect to HostAddress{host='nonexistent', port=3306, type='master'}. nonexistent.
      SQLState: 08
      VendorError: 0
      SQLException: Communications link failure with primary. No active connection found for master : Could not connect to HostAddress{host='nonexistent', port=3306, type='master'}. nonexistent.
      SQLState: 08
      VendorError: 0
      SQLException: Communications link failure with primary. No active connection found for master : Could not connect to HostAddress{host='nonexistent', port=3306, type='master'}. nonexistent.
      SQLState: 08
      VendorError: 0
      SQLException: Communications link failure with primary. No active connection found for master : Could not connect to HostAddress{host='nonexistent', port=3306, type='master'}. nonexistent.
      SQLState: 08
      VendorError: 0
      SQLException: Communications link failure with primary. No active connection found for master : Could not connect to HostAddress{host='nonexistent', port=3306, type='master'}. nonexistent.
      SQLState: 08
      VendorError: 0
      SQLException: Communications link failure with primary. No active connection found for master : Could not connect to HostAddress{host='nonexistent', port=3306, type='master'}. nonexistent.
      SQLState: 08
      VendorError: 0
      SQLException: Communications link failure with primary. No active connection found for master : Could not connect to HostAddress{host='nonexistent', port=3306, type='master'}. nonexistent.
      SQLState: 08
      VendorError: 0
      SQLException: Communications link failure with primary. No active connection found for master : Could not connect to HostAddress{host='nonexistent', port=3306, type='master'}. nonexistent.
      SQLState: 08
      VendorError: 0
      

        Attachments

          Activity

            People

            Assignee:
            diego dupin Diego Dupin
            Reporter:
            GeoffMontee Geoff Montee
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration