kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | d148d19e0bb59cb261f142293cae33a1fc14a79858fc531a66156356d5dddcda |
|---|---|
| Author | Olivier Michallat <olim7t@users.noreply.github.com> · 2015-04-17 23:02 +02:00 |
| Committer | Olivier Michallat <olim7t@users.noreply.github.com> · 2015-04-17 23:02 +02:00 |
| Parents | 0af82488f207, dc0b7d27d87e |
10 files changed
modified driver-core/CHANGELOG.rst +1 −0
| @@ -40,6 +40,7 @@ | ||
| 40 | 40 | schema-altering statement (JAVA-669) |
| 41 | 41 | - [improvement] Make connection and pool creation fully async (JAVA-692) |
| 42 | 42 | - [improvement] Optimize connection use after reconnection (JAVA-505) |
| 43 | +- [improvement] Remove "suspected" mechanism (JAVA-617) | |
| 43 | 44 | |
| 44 | 45 | Merged from 2.0.9_fixes branch: |
| 45 | 46 |
modified driver-core/src/main/java/com/datastax/driver/core/Cluster.java +5 −86
| @@ -1518,77 +1518,13 @@ | ||
| 1518 | 1518 | return executor.submit(new ExceptionCatchingRunnable() { |
| 1519 | 1519 | @Override |
| 1520 | 1520 | public void runMayThrow() throws InterruptedException, ExecutionException { |
| 1521 | - onDown(host, isHostAddition, false, startReconnection); | |
| 1521 | + onDown(host, isHostAddition, startReconnection); | |
| 1522 | 1522 | } |
| 1523 | 1523 | }); |
| 1524 | 1524 | } |
| 1525 | 1525 | |
| 1526 | - public void onSuspected(final Host host) { | |
| 1527 | - logger.debug("Host {} is Suspected", host); | |
| 1528 | - | |
| 1529 | - if (isClosed()) | |
| 1530 | - return; | |
| 1531 | - | |
| 1532 | - // We shouldn't really get there for IGNORED nodes since we shouldn't have | |
| 1533 | - // connected to one in the first place, but if we ever do, simply hand it | |
| 1534 | - // off to onDown | |
| 1535 | - if (loadBalancingPolicy().distance(host) == HostDistance.IGNORED) { | |
| 1536 | - triggerOnDown(host, true); | |
| 1537 | - return; | |
| 1538 | - } | |
| 1539 | - | |
| 1540 | - // We need to | |
| 1541 | - // 1) mark the node suspect if no-one has bitten us to it | |
| 1542 | - // 2) start the reconnection attempt | |
| 1543 | - // 3) inform the loadbalancing policy | |
| 1544 | - // We must do 2) before 3) as we want the policy to be able to rely | |
| 1545 | - // on the reconnection attempt future. | |
| 1546 | - // | |
| 1547 | - // If multiple threads get there, we want to start reconnection attempts only | |
| 1548 | - // once, but we also don't want said threads to return from this method before | |
| 1549 | - // the loadbalancing policy has been informed (otherwise those threads won't | |
| 1550 | - // consider the host suspect but simply ignore it). So we synchronize. | |
| 1551 | - synchronized (host) { | |
| 1552 | - // If we've already marked the node down/suspected, ignore this | |
| 1553 | - if (!host.setSuspected() || host.reconnectionAttempt.get() != null) | |
| 1554 | - return; | |
| 1555 | - | |
| 1556 | - // Start the initial initial reconnection attempt | |
| 1557 | - host.initialReconnectionAttempt.set(executor.submit(new ExceptionCatchingRunnable() { | |
| 1558 | - @Override | |
| 1559 | - public void runMayThrow() throws InterruptedException, ExecutionException { | |
| 1560 | - boolean success; | |
| 1561 | - try { | |
| 1562 | - Connection connection = connectionFactory.open(host); | |
| 1563 | - // Note that we want to do the pool creation on this thread because we want that | |
| 1564 | - // when onUp return, the host is ready for querying | |
| 1565 | - onUp(host, connection); | |
| 1566 | - // If one of the connections in onUp failed, it signaled the error and triggerd onDown, | |
| 1567 | - // but onDown aborted because this reconnection attempt was in progress (JAVA-577). | |
| 1568 | - // Test the state now to check than onUp succeeded (we know it's up-to-date since onUp was | |
| 1569 | - // executed synchronously). | |
| 1570 | - success = host.state == Host.State.UP; | |
| 1571 | - } catch (Exception e) { | |
| 1572 | - success = false; | |
| 1573 | - } | |
| 1574 | - if (!success) | |
| 1575 | - onDown(host, false, true, true); | |
| 1576 | - } | |
| 1577 | - })); | |
| 1578 | - | |
| 1579 | - loadBalancingPolicy().onSuspected(host); | |
| 1580 | - } | |
| 1581 | - | |
| 1582 | - controlConnection.onSuspected(host); | |
| 1583 | - for (SessionManager s : sessions) | |
| 1584 | - s.onSuspected(host); | |
| 1585 | - | |
| 1586 | - for (Host.StateListener listener : listeners) | |
| 1587 | - listener.onSuspected(host); | |
| 1588 | - } | |
| 1589 | - | |
| 1590 | 1526 | // Use triggerOnDown unless you're sure you want to run this on the current thread. |
| 1591 | - private void onDown(final Host host, final boolean isHostAddition, final boolean isSuspectedVerification, boolean startReconnection) throws InterruptedException, ExecutionException { | |
| 1527 | + private void onDown(final Host host, final boolean isHostAddition, boolean startReconnection) throws InterruptedException, ExecutionException { | |
| 1592 | 1528 | logger.debug("Host {} is DOWN", host); |
| 1593 | 1529 | |
| 1594 | 1530 | if (isClosed()) |
| @@ -1601,14 +1537,6 @@ | ||
| 1601 | 1537 | } |
| 1602 | 1538 | try { |
| 1603 | 1539 | |
| 1604 | - // If we're SUSPECT and not the task validating the suspicion, then some other task is | |
| 1605 | - // already checking to verify if the node is really down (or if it's simply that the | |
| 1606 | - // connections where broken). So just skip this in that case. | |
| 1607 | - if (!isSuspectedVerification && host.state == Host.State.SUSPECT) { | |
| 1608 | - logger.debug("Aborting onDown because a reconnection is running on SUSPECT host {}", host); | |
| 1609 | - return; | |
| 1610 | - } | |
| 1611 | - | |
| 1612 | 1540 | // Note: we don't want to skip that method if !host.isUp() because we set isUp |
| 1613 | 1541 | // late in onUp, and so we can rely on isUp if there is an error during onUp. |
| 1614 | 1542 | // But if there is a reconnection attempt in progress already, then we know |
| @@ -1889,24 +1817,15 @@ | ||
| 1889 | 1817 | } |
| 1890 | 1818 | } |
| 1891 | 1819 | |
| 1892 | - public boolean signalConnectionFailure(Host host, ConnectionException exception, boolean isHostAddition, boolean markSuspected) { | |
| 1820 | + public boolean signalConnectionFailure(Host host, ConnectionException exception, boolean isHostAddition) { | |
| 1893 | 1821 | // Don't signal failure until we've fully initialized the controlConnection as this might mess up with |
| 1894 | 1822 | // the protocol detection |
| 1895 | 1823 | if (!isFullyInit || isClosed()) |
| 1896 | 1824 | return true; |
| 1897 | 1825 | |
| 1898 | 1826 | boolean isDown = host.signalConnectionFailure(exception); |
| 1899 | - if (isDown) { | |
| 1900 | - if (isHostAddition || !markSuspected) { | |
| 1901 | - triggerOnDown(host, isHostAddition, true); | |
| 1902 | - } else { | |
| 1903 | - // Note that we do want to call onSuspected on the current thread, as the whole point is | |
| 1904 | - // that by the time this method return, the host initialReconnectionAttempt will have been | |
| 1905 | - // set and the load balancing policy informed of the suspection. We know that onSuspected | |
| 1906 | - // does little work (and non blocking one) itself however. | |
| 1907 | - onSuspected(host); | |
| 1908 | - } | |
| 1909 | - } | |
| 1827 | + if (isDown) | |
| 1828 | + triggerOnDown(host, isHostAddition, true); | |
| 1910 | 1829 | return isDown; |
| 1911 | 1830 | } |
| 1912 | 1831 |
modified driver-core/src/main/java/com/datastax/driver/core/Connection.java +1 −13
| @@ -390,23 +390,11 @@ | ||
| 390 | 390 | ? (ConnectionException)e |
| 391 | 391 | : new ConnectionException(address, "Connection problem", e); |
| 392 | 392 | |
| 393 | - // We need to signal the connection failure before erroring out handlers to make | |
| 394 | - // sure the "suspected" mechanism work as expected | |
| 395 | 393 | Host host = factory.manager.metadata.getHost(address); |
| 396 | 394 | if (host != null) { |
| 397 | - | |
| 398 | - // If the host was reconnecting, and this error happens right after we opened a connection pool, but | |
| 399 | - // before we could mark the node UP, we don't want to go through the SUSPECTED state, because that can | |
| 400 | - // lead to a race condition that leaves the node UP with a closed pool. | |
| 401 | - HostConnectionPool pool = this.poolRef.get(); | |
| 402 | - boolean belongsToReconnectingPool = host.state != Host.State.UP && | |
| 403 | - (pool == null || !pool.isClosed()); | |
| 404 | - | |
| 405 | - boolean markSuspected = isInitialized && !belongsToReconnectingPool; | |
| 406 | - | |
| 407 | 395 | // This will trigger onDown, including when the defunct Connection is part of a reconnection attempt, which is redundant. |
| 408 | 396 | // This is not too much of a problem since calling onDown on a node that is already down has no effect. |
| 409 | - boolean isDown = factory.manager.signalConnectionFailure(host, ce, host.wasJustAdded(), markSuspected); | |
| 397 | + boolean isDown = factory.manager.signalConnectionFailure(host, ce, host.wasJustAdded()); | |
| 410 | 398 | notifyOwnerWhenDefunct(isDown); |
| 411 | 399 | } |
| 412 | 400 |
modified driver-core/src/main/java/com/datastax/driver/core/Host.java +11 −16
| @@ -41,7 +41,7 @@ | ||
| 41 | 41 | |
| 42 | 42 | private final InetSocketAddress address; |
| 43 | 43 | |
| 44 | - enum State { ADDED, DOWN, SUSPECT, UP } | |
| 44 | + enum State { ADDED, DOWN, UP } | |
| 45 | 45 | volatile State state; |
| 46 | 46 | /** Ensures state change notifications for that host are handled serially */ |
| 47 | 47 | final ReentrantLock notificationsLock = new ReentrantLock(true); |
| @@ -49,9 +49,6 @@ | ||
| 49 | 49 | private final ConvictionPolicy policy; |
| 50 | 50 | private final Cluster.Manager manager; |
| 51 | 51 | |
| 52 | - // Tracks the first "immediate" reconnection attempt when a node get suspected. | |
| 53 | - final AtomicReference<ListenableFuture<?>> initialReconnectionAttempt = new AtomicReference<ListenableFuture<?>>(MoreFutures.VOID_SUCCESS); | |
| 54 | - | |
| 55 | 52 | // Tracks later reconnection attempts to that host so we avoid adding multiple tasks. |
| 56 | 53 | final AtomicReference<ListenableFuture<?>> reconnectionAttempt = new AtomicReference<ListenableFuture<?>>(); |
| 57 | 54 | |
| @@ -188,9 +185,7 @@ | ||
| 188 | 185 | * @return whether the node is considered up. |
| 189 | 186 | */ |
| 190 | 187 | public boolean isUp() { |
| 191 | - // Consider a suspected host UP until proved otherwise to avoid | |
| 192 | - // having the status flapping if it turns out the host is not really down. | |
| 193 | - return state == State.UP || state == State.SUSPECT; | |
| 188 | + return state == State.UP; | |
| 194 | 189 | } |
| 195 | 190 | |
| 196 | 191 | /** |
| @@ -214,9 +209,13 @@ | ||
| 214 | 209 | * we are trying suspected nodes. |
| 215 | 210 | * |
| 216 | 211 | * @return the future. |
| 212 | + * | |
| 213 | + * @deprecated the suspicion mechanism has been disabled. This will always return | |
| 214 | + * a completed future. | |
| 217 | 215 | */ |
| 216 | + @Deprecated | |
| 218 | 217 | public ListenableFuture<?> getInitialReconnectionAttemptFuture() { |
| 219 | - return initialReconnectionAttempt.get(); | |
| 218 | + return Futures.immediateFuture(null); | |
| 220 | 219 | } |
| 221 | 220 | |
| 222 | 221 | /** |
| @@ -284,14 +283,6 @@ | ||
| 284 | 283 | state = State.UP; |
| 285 | 284 | } |
| 286 | 285 | |
| 287 | - boolean setSuspected() { | |
| 288 | - if (state != State.UP) | |
| 289 | - return false; | |
| 290 | - | |
| 291 | - state = State.SUSPECT; | |
| 292 | - return true; | |
| 293 | - } | |
| 294 | - | |
| 295 | 286 | boolean signalConnectionFailure(ConnectionException exception) { |
| 296 | 287 | return policy.addFailure(exception); |
| 297 | 288 | } |
| @@ -341,7 +332,11 @@ | ||
| 341 | 332 | * that is suspected down turns out to be truly down (that is, the driver |
| 342 | 333 | * cannot successfully connect to it right away), then {@link onDown} will |
| 343 | 334 | * be called. |
| 335 | + * | |
| 336 | + * @deprecated the suspicion mechanism has been disabled. This will never | |
| 337 | + * get called. | |
| 344 | 338 | */ |
| 339 | + @Deprecated | |
| 345 | 340 | public void onSuspected(Host host); |
| 346 | 341 | |
| 347 | 342 | /** |
modified driver-core/src/main/java/com/datastax/driver/core/SessionManager.java +0 −3
| @@ -423,9 +423,6 @@ | ||
| 423 | 423 | updateCreatedPools(); |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | - void onSuspected(Host host) { | |
| 427 | - } | |
| 428 | - | |
| 429 | 426 | void onRemove(Host host) throws InterruptedException, ExecutionException { |
| 430 | 427 | onDown(host); |
| 431 | 428 | } |
modified driver-core/src/main/java/com/datastax/driver/core/policies/DCAwareRoundRobinPolicy.java +19 −78
| @@ -65,8 +65,6 @@ | ||
| 65 | 65 | @VisibleForTesting |
| 66 | 66 | volatile String localDc; |
| 67 | 67 | |
| 68 | - private final ConcurrentMap<String, CopyOnWriteArrayList<Host>> perDcSuspectedHosts = new ConcurrentHashMap<String, CopyOnWriteArrayList<Host>>(); | |
| 69 | - | |
| 70 | 68 | private final int usedHostsPerRemoteDc; |
| 71 | 69 | private final boolean dontHopForLocalCL; |
| 72 | 70 | |
| @@ -281,51 +279,23 @@ | ||
| 281 | 279 | private int idx = startIdx; |
| 282 | 280 | private int remainingLocal = hosts.size(); |
| 283 | 281 | |
| 284 | - private Iterator<Host> localSuspected; | |
| 285 | - | |
| 286 | 282 | // For remote Dcs |
| 287 | 283 | private Iterator<String> remoteDcs; |
| 288 | 284 | private List<Host> currentDcHosts; |
| 289 | 285 | private int currentDcRemaining; |
| 290 | - private Iterator<Host> currentDcSuspected; | |
| 291 | 286 | |
| 292 | 287 | @Override |
| 293 | 288 | protected Host computeNext() { |
| 294 | - if (remainingLocal > 0) { | |
| 295 | - remainingLocal--; | |
| 296 | - int c = idx++ % hosts.size(); | |
| 297 | - if (c < 0) { | |
| 298 | - c += hosts.size(); | |
| 289 | + while (true) { | |
| 290 | + if (remainingLocal > 0) { | |
| 291 | + remainingLocal--; | |
| 292 | + int c = idx++ % hosts.size(); | |
| 293 | + if (c < 0) { | |
| 294 | + c += hosts.size(); | |
| 295 | + } | |
| 296 | + return hosts.get(c); | |
| 299 | 297 | } |
| 300 | - return hosts.get(c); | |
| 301 | - } | |
| 302 | - | |
| 303 | - if (localSuspected == null) { | |
| 304 | - List<Host> l = perDcSuspectedHosts.get(localDc); | |
| 305 | - localSuspected = l == null ? Collections.<Host>emptySet().iterator() : l.iterator(); | |
| 306 | - } | |
| 307 | - | |
| 308 | - while (localSuspected.hasNext()) { | |
| 309 | - Host h = localSuspected.next(); | |
| 310 | - waitOnReconnection(h); | |
| 311 | - if (h.isUp()) | |
| 312 | - return h; | |
| 313 | - } | |
| 314 | - | |
| 315 | - ConsistencyLevel cl = statement.getConsistencyLevel() == null | |
| 316 | - ? configuration.getQueryOptions().getConsistencyLevel() | |
| 317 | - : statement.getConsistencyLevel(); | |
| 318 | - | |
| 319 | - if (dontHopForLocalCL && cl.isDCLocal()) | |
| 320 | - return endOfData(); | |
| 321 | - | |
| 322 | - if (remoteDcs == null) { | |
| 323 | - Set<String> copy = new HashSet<String>(perDcLiveHosts.keySet()); | |
| 324 | - copy.remove(localDc); | |
| 325 | - remoteDcs = copy.iterator(); | |
| 326 | - } | |
| 327 | 298 | |
| 328 | - while (true) { | |
| 329 | 299 | if (currentDcHosts != null && currentDcRemaining > 0) { |
| 330 | 300 | currentDcRemaining--; |
| 331 | 301 | int c = idx++ % currentDcHosts.size(); |
| @@ -335,13 +305,17 @@ | ||
| 335 | 305 | return currentDcHosts.get(c); |
| 336 | 306 | } |
| 337 | 307 | |
| 338 | - if (currentDcSuspected != null) { | |
| 339 | - while (currentDcSuspected.hasNext()) { | |
| 340 | - Host h = currentDcSuspected.next(); | |
| 341 | - waitOnReconnection(h); | |
| 342 | - if (h.isUp()) | |
| 343 | - return h; | |
| 344 | - } | |
| 308 | + ConsistencyLevel cl = statement.getConsistencyLevel() == null | |
| 309 | + ? configuration.getQueryOptions().getConsistencyLevel() | |
| 310 | + : statement.getConsistencyLevel(); | |
| 311 | + | |
| 312 | + if (dontHopForLocalCL && cl.isDCLocal()) | |
| 313 | + return endOfData(); | |
| 314 | + | |
| 315 | + if (remoteDcs == null) { | |
| 316 | + Set<String> copy = new HashSet<String>(perDcLiveHosts.keySet()); | |
| 317 | + copy.remove(localDc); | |
| 318 | + remoteDcs = copy.iterator(); | |
| 345 | 319 | } |
| 346 | 320 | |
| 347 | 321 | if (!remoteDcs.hasNext()) |
| @@ -355,27 +329,12 @@ | ||
| 355 | 329 | currentDcHosts = dcHosts.subList(0, Math.min(dcHosts.size(), usedHostsPerRemoteDc)); |
| 356 | 330 | currentDcRemaining = currentDcHosts.size(); |
| 357 | 331 | } |
| 358 | - List<Host> suspectedList = perDcSuspectedHosts.get(nextRemoteDc); | |
| 359 | - currentDcSuspected = suspectedList == null ? null : suspectedList.iterator(); | |
| 360 | 332 | } |
| 361 | 333 | return endOfData(); |
| 362 | 334 | } |
| 363 | 335 | }; |
| 364 | 336 | } |
| 365 | 337 | |
| 366 | - private void waitOnReconnection(Host h) { | |
| 367 | - try { | |
| 368 | - h.getInitialReconnectionAttemptFuture().get(configuration.getSocketOptions().getConnectTimeoutMillis(), TimeUnit.MILLISECONDS); | |
| 369 | - } catch (InterruptedException e) { | |
| 370 | - Thread.currentThread().interrupt(); | |
| 371 | - } catch (ExecutionException e) { | |
| 372 | - throw new AssertionError(e); | |
| 373 | - } catch (TimeoutException e) { | |
| 374 | - // Shouldn't really happen but isn't really a huge deal | |
| 375 | - logger.debug("Timeout while waiting on initial reconnection future for " + h, e); | |
| 376 | - } | |
| 377 | - } | |
| 378 | - | |
| 379 | 338 | @Override |
| 380 | 339 | public void onUp(Host host) { |
| 381 | 340 | String dc = dc(host); |
| @@ -395,24 +354,10 @@ | ||
| 395 | 354 | return; |
| 396 | 355 | } |
| 397 | 356 | dcHosts.addIfAbsent(host); |
| 398 | - | |
| 399 | - CopyOnWriteArrayList<Host> dcSuspected = perDcSuspectedHosts.get(dc(host)); | |
| 400 | - if (dcSuspected != null) | |
| 401 | - dcSuspected.remove(host); | |
| 402 | 357 | } |
| 403 | 358 | |
| 404 | 359 | @Override |
| 405 | 360 | public void onSuspected(Host host) { |
| 406 | - String dc = dc(host); | |
| 407 | - CopyOnWriteArrayList<Host> dcSuspected = perDcSuspectedHosts.get(dc); | |
| 408 | - if (dcSuspected == null) { | |
| 409 | - CopyOnWriteArrayList<Host> newMap = new CopyOnWriteArrayList<Host>(Collections.singletonList(host)); | |
| 410 | - dcSuspected = perDcSuspectedHosts.putIfAbsent(dc, newMap); | |
| 411 | - // If we've successfully put our new host, we're good, otherwise we've been beaten so continue | |
| 412 | - if (dcSuspected == null) | |
| 413 | - return; | |
| 414 | - } | |
| 415 | - dcSuspected.addIfAbsent(host); | |
| 416 | 361 | } |
| 417 | 362 | |
| 418 | 363 | @Override |
| @@ -420,10 +365,6 @@ | ||
| 420 | 365 | CopyOnWriteArrayList<Host> dcHosts = perDcLiveHosts.get(dc(host)); |
| 421 | 366 | if (dcHosts != null) |
| 422 | 367 | dcHosts.remove(host); |
| 423 | - | |
| 424 | - CopyOnWriteArrayList<Host> dcSuspected = perDcSuspectedHosts.get(dc(host)); | |
| 425 | - if (dcSuspected != null) | |
| 426 | - dcSuspected.remove(host); | |
| 427 | 368 | } |
| 428 | 369 | |
| 429 | 370 | @Override |
modified driver-core/src/main/java/com/datastax/driver/core/policies/RoundRobinPolicy.java +1 −31
| @@ -55,8 +55,6 @@ | ||
| 55 | 55 | private final CopyOnWriteArrayList<Host> liveHosts = new CopyOnWriteArrayList<Host>(); |
| 56 | 56 | private final AtomicInteger index = new AtomicInteger(); |
| 57 | 57 | |
| 58 | - private final CopyOnWriteArrayList<Host> suspectedHosts = new CopyOnWriteArrayList<Host>(); | |
| 59 | - | |
| 60 | 58 | private volatile Configuration configuration; |
| 61 | 59 | private volatile boolean hasLoggedLocalCLUse; |
| 62 | 60 | |
| @@ -132,23 +130,11 @@ | ||
| 132 | 130 | |
| 133 | 131 | private int idx = startIdx; |
| 134 | 132 | private int remaining = hosts.size(); |
| 135 | - private Iterator<Host> suspected; | |
| 136 | 133 | |
| 137 | 134 | @Override |
| 138 | 135 | protected Host computeNext() { |
| 139 | - if (remaining <= 0) { | |
| 140 | - | |
| 141 | - if (suspected == null) | |
| 142 | - suspected = suspectedHosts.iterator(); | |
| 143 | - | |
| 144 | - while (suspected.hasNext()) { | |
| 145 | - Host h = suspected.next(); | |
| 146 | - waitOnReconnection(h); | |
| 147 | - if (h.isUp()) | |
| 148 | - return h; | |
| 149 | - } | |
| 136 | + if (remaining <= 0) | |
| 150 | 137 | return endOfData(); |
| 151 | - } | |
| 152 | 138 | |
| 153 | 139 | remaining--; |
| 154 | 140 | int c = idx++ % hosts.size(); |
| @@ -159,34 +145,18 @@ | ||
| 159 | 145 | }; |
| 160 | 146 | } |
| 161 | 147 | |
| 162 | - private void waitOnReconnection(Host h) { | |
| 163 | - try { | |
| 164 | - h.getInitialReconnectionAttemptFuture().get(configuration.getSocketOptions().getConnectTimeoutMillis(), TimeUnit.MILLISECONDS); | |
| 165 | - } catch (InterruptedException e) { | |
| 166 | - Thread.currentThread().interrupt(); | |
| 167 | - } catch (ExecutionException e) { | |
| 168 | - throw new AssertionError(e); | |
| 169 | - } catch (TimeoutException e) { | |
| 170 | - // Shouldn't really happen but isn't really a huge deal | |
| 171 | - logger.debug("Timeout while waiting only host initial reconnection future", e); | |
| 172 | - } | |
| 173 | - } | |
| 174 | - | |
| 175 | 148 | @Override |
| 176 | 149 | public void onUp(Host host) { |
| 177 | 150 | liveHosts.addIfAbsent(host); |
| 178 | - suspectedHosts.remove(host); | |
| 179 | 151 | } |
| 180 | 152 | |
| 181 | 153 | @Override |
| 182 | 154 | public void onSuspected(Host host) { |
| 183 | - suspectedHosts.addIfAbsent(host); | |
| 184 | 155 | } |
| 185 | 156 | |
| 186 | 157 | @Override |
| 187 | 158 | public void onDown(Host host) { |
| 188 | 159 | liveHosts.remove(host); |
| 189 | - suspectedHosts.remove(host); | |
| 190 | 160 | } |
| 191 | 161 | |
| 192 | 162 | @Override |
modified driver-core/src/test/java/com/datastax/driver/core/HostAssert.java +0 −7
| @@ -53,13 +53,6 @@ | ||
| 53 | 53 | return this; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - public HostAssert isNotReconnectingFromSuspected() { | |
| 57 | - assertThat(actual.getInitialReconnectionAttemptFuture() != null && !actual.getInitialReconnectionAttemptFuture().isDone()) | |
| 58 | - .isFalse(); | |
| 59 | - return this; | |
| 60 | - | |
| 61 | - } | |
| 62 | - | |
| 63 | 56 | public HostAssert comesUpWithin(long duration, TimeUnit unit) { |
| 64 | 57 | final CountDownLatch upSignal = new CountDownLatch(1); |
| 65 | 58 | StateListener upListener = new StateListenerBase() { |
modified driver-core/src/test/java/com/datastax/driver/core/RecommissionedNodeTest.java +2 −4
| @@ -111,8 +111,7 @@ | ||
| 111 | 111 | // Node 1 should now be DOWN with no reconnection attempt |
| 112 | 112 | assertThat(mainCluster).host(1) |
| 113 | 113 | .hasState(DOWN) |
| 114 | - .isNotReconnectingFromDown() | |
| 115 | - .isNotReconnectingFromSuspected(); | |
| 114 | + .isNotReconnectingFromDown(); | |
| 116 | 115 | } |
| 117 | 116 | |
| 118 | 117 | @Test(groups = "long") |
| @@ -135,8 +134,7 @@ | ||
| 135 | 134 | // Node 1 should now be DOWN with no reconnection attempt |
| 136 | 135 | assertThat(mainCluster).host(1) |
| 137 | 136 | .hasState(DOWN) |
| 138 | - .isNotReconnectingFromDown() | |
| 139 | - .isNotReconnectingFromSuspected(); | |
| 137 | + .isNotReconnectingFromDown(); | |
| 140 | 138 | } |
| 141 | 139 | |
| 142 | 140 | @AfterMethod(groups = "long") |
modified driver-core/src/test/java/com/datastax/driver/core/policies/LimitingLoadBalancingPolicy.java +0 −7
| @@ -133,13 +133,6 @@ | ||
| 133 | 133 | onAdd(host); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - @Override | |
| 137 | - public void onSuspected(Host host) { | |
| 138 | - // If a node gets suspected, it means the driver was connected to it, so it was a chosen node. | |
| 139 | - // Keep it as chosen for now, but notify the child policy which might reorder the query plan accordingly. | |
| 140 | - delegate.onSuspected(host); | |
| 141 | - } | |
| 142 | - | |
| 143 | 136 | @Override |
| 144 | 137 | public void onDown(Host host) { |
| 145 | 138 | delegate.onDown(host); |