[CONJ-510] Permit connection creation to allow execution of read-only statements on slaves when master is down Created: 2017-08-07 Updated: 2020-08-25 Resolved: 2017-11-08 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | Failover |
| Affects Version/s: | 2.1.0 |
| Fix Version/s: | 2.2.0 |
| Type: | Task | Priority: | Major |
| Reporter: | Geoff Montee (Inactive) | Assignee: | Diego Dupin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| 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:
|
| Comments |
| Comment by Diego Dupin [ 2017-08-17 ] |
|
Actually, existing connection permit that functionnality : But driver doesn't permit to create new connection since JDBC default to use master connection. This option make sense to permit creating a new connection even if no master connection is up. |
| Comment by Geoff Montee (Inactive) [ 2018-02-09 ] |
|
Based on the code changes in the commit for this feature request, it looks like "allowMasterDownConnection=true" needs to be set in order to make this work. Is that correct? If so, I don't see this new option documented yet: https://mariadb.com/kb/en/library/about-mariadb-connector-j/#optional-url-parameters |
| Comment by Diego Dupin [ 2018-02-13 ] |
|
Exactly. |