Bug #75169 Add the failedOver SQLException matches condition like load balancing drive
| Submitted: | 11 Dec 2014 4:05 | Modified: | 23 Mar 2015 17:45 |
|---|---|---|---|
| Reporter: | Aiden Zhang | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | Connector / J | Severity: | S4 (Feature request) |
| Version: | 5.1.34 | OS: | Any |
| Assigned to: | Filipe Silva | CPU Architecture: | Any |
| Tags: | failedOver, SQLException matches condition | ||
[12 Dec 2014 14:28]
Filipe Silva
Hi Aiden, Thank you for this feature request report.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: I check that the FailoverConnectionProxy do failover when any exception happends, but sometimes I just want let it failover just when some given conditions, like some SQLException like the load balancing JDBC driver. How to repeat: JDBC URL, "jdbc:mysql://10.228.169.99:3306,10.228.169.100:3306/rad_wifi?user=aicent&password=aicent&allowMasterDownConnections=false&autoReconnectForPools=true&secondsBeforeRetryMaster=10&failOverReadOnly=false&loadBalanceExceptionChecker=com.aicent.wifi.jdbc.ha.MyLoadBalanceExceptionChecker&retriesAllDown=10"; note that, it is a failOver JDBC, not the load balancing JDBC. not the prefix, jdbc:mysql:loadbalance:// Suggested fix: File: FailoverConnectionProxy.java Method: synchronized void dealWithInvocationException(InvocationTargetException e) Improvement: if (t != null) { if (this.failedOver) { // try and fall back createPrimaryConnection(); if (this.currentConn != null) { throw t; } } failOver(); throw t; } changed to, if (t != null) { if (t instanceof SQLException && shouldExceptionTriggerFailover((SQLException) t)) { if (this.failedOver) { // try and fall back createPrimaryConnection(); if (this.currentConn != null) { throw t; } } failOver(); } throw t; }