Skip to content

Commit

Permalink
Fix FailoverConnectionPlugin update topology and exception triggered …
Browse files Browse the repository at this point in the history
…connect switch code to not use stale topology info

clean up test/debug code and comments
  • Loading branch information
alecc-bq authored and aaronchung-bitquill committed Jan 18, 2023
1 parent 6e3736b commit cb80770
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,10 @@ protected synchronized void pickNewConnection() throws SQLException {

protected boolean shouldExceptionTriggerConnectionSwitch(Throwable t) {

if (!isFailoverEnabled()) {
if (!this.enableFailoverSetting
|| this.isRdsProxy
|| !this.isClusterTopologyAvailable
|| this.isMultiWriterCluster) {
this.logger.logDebug(Messages.getString("ClusterAwareConnectionProxy.13"));
return false;
}
Expand Down Expand Up @@ -710,11 +713,14 @@ protected void syncSessionState(
protected void updateTopologyAndConnectIfNeeded(boolean forceUpdate)
throws SQLException {
final JdbcConnection connection = this.currentConnectionProvider.getCurrentConnection();
if (!isFailoverEnabled()
|| connection == null
|| connection.isClosed()
|| connection.isInPreparedTx()) {
return;
if (
!this.enableFailoverSetting
|| this.isRdsProxy
|| !this.isClusterTopologyAvailable
|| connection == null
|| connection.isClosed()
|| connection.isInPreparedTx()) {
return;
}

List<HostInfo> latestTopology =
Expand Down

0 comments on commit cb80770

Please sign in to comment.