Skip to content

Commit

Permalink
Remove logic that changes connection to a writer (#427)
Browse files Browse the repository at this point in the history
### Summary

Remove logic that changes connection to a writer when setReadOnly(false)
is called on reader connection.
#426

### Additional Reviewers

@karenc-bq 
@aaron-congo 

### By submitting this pull request, I confirm that my contribution is
made under the terms of the Apache 2.0 license.

Co-authored-by: sergiyv-bitquill <[email protected]>
  • Loading branch information
sergiyvamz and sergiyv-improving authored May 3, 2023
1 parent 6cfc4f3 commit 30c0db2
Showing 1 changed file with 0 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -433,16 +433,6 @@ private void connectTo(final HostSpec host) throws SQLException {
}
}

private void connectToWriterIfRequired(final Boolean readOnly) throws SQLException {
if (shouldReconnectToWriter(readOnly) && !Utils.isNullOrEmpty(this.pluginService.getHosts())) {
try {
connectTo(getCurrentWriter());
} catch (final SQLException e) {
failover(getCurrentWriter());
}
}
}

/**
* Checks if the given host index points to the primary host.
*
Expand All @@ -462,7 +452,6 @@ private void performSpecialMethodHandlingIfRequired(final Object[] args, final S
() -> Messages.get(
"Failover.parameterValue",
new Object[] {"explicitlyReadOnly", this.explicitlyReadOnly}));
connectToWriterIfRequired(this.explicitlyReadOnly);
}
}

Expand All @@ -489,10 +478,6 @@ boolean shouldPerformWriterFailover() {
return this.explicitlyReadOnly == null || !this.explicitlyReadOnly;
}

private boolean shouldReconnectToWriter(final Boolean readOnly) {
return readOnly != null && !readOnly && !isWriter(this.pluginService.getCurrentHostSpec());
}

/**
* Replaces the previous underlying connection by the connection given. State from previous
* connection, if any, is synchronized with the new one.
Expand Down

0 comments on commit 30c0db2

Please sign in to comment.