kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 3cb9a3ede2468a1ee3e238f2eb7b018863b4c6bbae7249687ceac5abe36bdc66 |
|---|---|
| Author | olim7t <omichallat+github@gmail.com> · 2014-12-19 00:08 +01:00 |
| Committer | olim7t <omichallat+github@gmail.com> · 2014-12-19 00:33 +01:00 |
| Parents | 0fe9369e8f1b |
2 files changed
modified driver-core/CHANGELOG.rst +2 −0
| @@ -17,6 +17,8 @@ | ||
| 17 | 17 | - [bug] Prevent faulty control connection from ignoring reconnecting hosts |
| 18 | 18 | (JAVA-587) |
| 19 | 19 | - temporarily revert "Add idle timeout to the connection pool" (JAVA-419) |
| 20 | +- [bug] Ensure updateCreatedPools does not add pools for suspected hosts | |
| 21 | + (JAVA-593) | |
| 20 | 22 | |
| 21 | 23 | |
| 22 | 24 | 2.0.8: |
modified driver-core/src/main/java/com/datastax/driver/core/SessionManager.java +7 −5
| @@ -15,7 +15,6 @@ | ||
| 15 | 15 | */ |
| 16 | 16 | package com.datastax.driver.core; |
| 17 | 17 | |
| 18 | -import java.net.InetAddress; | |
| 19 | 18 | import java.net.InetSocketAddress; |
| 20 | 19 | import java.nio.ByteBuffer; |
| 21 | 20 | import java.util.*; |
| @@ -30,7 +29,6 @@ | ||
| 30 | 29 | import org.slf4j.LoggerFactory; |
| 31 | 30 | |
| 32 | 31 | |
| 33 | -import com.datastax.driver.core.exceptions.AuthenticationException; | |
| 34 | 32 | import com.datastax.driver.core.exceptions.DriverInternalError; |
| 35 | 33 | import com.datastax.driver.core.exceptions.UnsupportedFeatureException; |
| 36 | 34 | import com.datastax.driver.core.policies.LoadBalancingPolicy; |
| @@ -270,7 +268,11 @@ | ||
| 270 | 268 | return false; |
| 271 | 269 | |
| 272 | 270 | HostConnectionPool newPool = new HostConnectionPool(host, distance, this); |
| 273 | - pools.put(host, newPool); | |
| 271 | + previous = pools.put(host, newPool); | |
| 272 | + if (previous != null && !previous.isClosed()) { | |
| 273 | + logger.warn("Replacing a pool that wasn't closed. Closing it now, but this was not expected."); | |
| 274 | + previous.closeAsync(); | |
| 275 | + } | |
| 274 | 276 | |
| 275 | 277 | // If we raced with a session shutdown, ensure that the pool will be closed. |
| 276 | 278 | if (isClosing) |
| @@ -348,7 +350,7 @@ | ||
| 348 | 350 | HostConnectionPool pool = pools.get(h); |
| 349 | 351 | |
| 350 | 352 | if (pool == null) { |
| 351 | - if (dist != HostDistance.IGNORED && h.isUp()) | |
| 353 | + if (dist != HostDistance.IGNORED && h.state == Host.State.UP) | |
| 352 | 354 | poolCreationFutures.add(maybeAddPool(h, executor)); |
| 353 | 355 | } else if (dist != pool.hostDistance) { |
| 354 | 356 | if (dist == HostDistance.IGNORED) { |
| @@ -381,7 +383,7 @@ | ||
| 381 | 383 | |
| 382 | 384 | try { |
| 383 | 385 | if (pool == null) { |
| 384 | - if (dist != HostDistance.IGNORED && h.isUp()) | |
| 386 | + if (dist != HostDistance.IGNORED && h.state == Host.State.UP) | |
| 385 | 387 | maybeAddPool(h, executor).get(); |
| 386 | 388 | } else if (dist != pool.hostDistance) { |
| 387 | 389 | if (dist == HostDistance.IGNORED) { |