Bug #52231 | Standardize Exception checks for load-balancer | ||
---|---|---|---|
Submitted: | 19 Mar 2010 18:32 | Modified: | 24 Mar 2010 11:21 |
Reporter: | Todd Farmer (OCA) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / J | Severity: | S2 (Serious) |
Version: | 5.1.12 | OS: | Any |
Assigned to: | Todd Farmer | CPU Architecture: | Any |
[19 Mar 2010 18:32]
Todd Farmer
[19 Mar 2010 20:46]
Todd Farmer
Pushed in r916.
[24 Mar 2010 11:21]
Tony Bedford
An entry has been added to the 5.1.13: Logic in implementations of LoadBalancingConnectionProxy and LoadBalanceStrategy behaved differently as to which SQLExceptions trigger failover to a new host. The former looked at the first two characters of the SQLState: if (sqlState.startsWith("08")) ... The latter used a different test: if (sqlEx instanceof CommunicationsException || "08S01".equals(sqlEx.getSQLState())) { ... This meant it was possible for a new Connection object to throw an Exception when the first selected host was unavailable. This happened because MySqlIO.createNewIO() could throw an SQLException with a SQLState of “08001”, which did not trigger the “try another host” logic in the LoadBalanceStrategy implementations, so an Exception was thrown after having only attempted connecting to a single host.