Elffuss BraidHub

kikocis/java-driver public

Fix reconnection attempts to dead hosts

JAVA-325 #fixes
Changeset55c1f9ccf66b0197bd88d7220f94a8fbbd1d51aeb0f799fbf28d28f32b5543ad
AuthorSylvain Lebresne <sylvain@datastax.com> · 2014-05-08 17:33 +02:00
CommitterSylvain Lebresne <sylvain@datastax.com> · 2014-05-08 17:33 +02:00
Parents1210f1743d7c

Browse the files at this changeset

2 files changed

modified driver-core/CHANGELOG.rst +6 −0
@@ -1,6 +1,12 @@
11 CHANGELOG
22 =========
33
4+1.0.8:
5+------
6+
7+- [bug] Fix periodic reconnection to down hosts (JAVA-325)
8+
9+
410 1.0.7:
511 ------
612
modified driver-core/src/main/java/com/datastax/driver/core/Cluster.java +8 −2
@@ -994,9 +994,15 @@
994994 if (host.reconnectionAttempt.get() != null)
995995 return;
996996
997+ // Remember if we care about this node at all. We must call this before
998+ // we've signalled the load balancing policy, since most policy will always
999+ // IGNORE down nodes anyway.
1000+ HostDistance distance = loadBalancingPolicy().distance(host);
1001+
9971002 boolean wasUp = host.isUp();
9981003 host.setDown();
9991004
1005+
10001006 loadBalancingPolicy().onDown(host);
10011007 controlConnection.onDown(host);
10021008 for (SessionManager s : sessions)
@@ -1011,7 +1017,7 @@
10111017 }
10121018
10131019 // Don't start a reconnection if we ignore the node anyway (JAVA-314)
1014- if (loadBalancingPolicy().distance(host) == HostDistance.IGNORED)
1020+ if (distance == HostDistance.IGNORED)
10151021 return;
10161022
10171023 // Note: we basically waste the first successful reconnection, but it's probably not a big deal
@@ -1119,7 +1125,7 @@
11191125
11201126 host.setDown();
11211127
1122- logger.trace("Removing host {}", host);
1128+ logger.debug("Removing host {}", host);
11231129 loadBalancingPolicy().onRemove(host);
11241130 controlConnection.onRemove(host);
11251131 for (SessionManager s : sessions)