We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent adec50d commit 3f205f3Copy full SHA for 3f205f3
wrapper/src/main/java/software/amazon/jdbc/hostlistprovider/monitoring/ClusterTopologyMonitorImpl.java
@@ -868,6 +868,18 @@ public void run() {
868
connection = null;
869
}
870
871
+ if (!StringUtils.isNullOrEmpty(writerId)) {
872
+ try {
873
+ if (this.servicesContainer.getPluginService().getHostRole(connection) != HostRole.WRITER) {
874
+ // The first connection after failover may be stale.
875
+ writerId = null;
876
+ }
877
+ } catch (SQLException e) {
878
+ // Invalid connection, retry.
879
+ continue;
880
881
882
+
883
if (!StringUtils.isNullOrEmpty(writerId)) {
884
// this prevents closing connection in finally block
885
if (!this.monitor.nodeThreadsWriterConnection.compareAndSet(null, connection)) {
0 commit comments