Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
2.1.0
-
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
|