kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 6639672315a23ed09bde06e8e145a9e2d9a978c444bf617f22e08658b610437a |
|---|---|
| Author | Alexandre Dutra <alexandre.dutra@datastax.com> · 2016-05-02 15:03 +02:00 |
| Committer | Alexandre Dutra <alexandre.dutra@datastax.com> · 2016-05-02 15:03 +02:00 |
| Parents | 6d192516fada, 9c9a5537845d |
4 files changed
modified changelog/README.md +1 −0
| @@ -40,6 +40,7 @@ | ||
| 40 | 40 | - [bug] JAVA-1005: DowngradingConsistencyRetryPolicy does not work with EACH_QUORUM when 1 DC is down. |
| 41 | 41 | - [bug] JAVA-1002: Avoid deadlock when re-preparing a statement on other hosts. |
| 42 | 42 | - [bug] JAVA-1072: Ensure defunct connections are properly evicted from the pool. |
| 43 | +- [bug] JAVA-1152: Fix NPE at ControlConnection.refreshNodeListAndTokenMap(). | |
| 43 | 44 | |
| 44 | 45 | |
| 45 | 46 | ### 3.0.0 |
modified driver-core/src/main/java/com/datastax/driver/core/ControlConnection.java +2 −0
| @@ -582,6 +582,8 @@ | ||
| 582 | 582 | continue; |
| 583 | 583 | |
| 584 | 584 | InetSocketAddress rpcAddress = rpcAddressForPeerHost(row, connection.address, cluster); |
| 585 | + if (rpcAddress == null) | |
| 586 | + continue; | |
| 585 | 587 | foundHosts.add(rpcAddress); |
| 586 | 588 | dcs.add(row.getString("data_center")); |
| 587 | 589 | racks.add(row.getString("rack")); |
modified driver-core/src/test/java/com/datastax/driver/core/CCMCache.java +3 −3
| @@ -271,10 +271,10 @@ | ||
| 271 | 271 | // CCM nodes are started with -Xms500M -Xmx500M |
| 272 | 272 | // and allocate up to 100MB non-heap memory in the general case, |
| 273 | 273 | // to be conservative we treat 1 "slot" as 800Mb. |
| 274 | - // We leave 2 slots out to avoid starving system memory, | |
| 274 | + // We leave 3 slots out to avoid starving system memory, | |
| 275 | 275 | // and we pick a value with a minimum of 1 slot and a maximum of 8 slots. |
| 276 | - // For example, an 8GB VM with ~6.5GB currently available heap will yield 6 slots ((6500/800) - 2 = 6). | |
| 277 | - long slotsAvailable = (freeMemoryMB / ONE_CCM_NODE_MB) - 2; | |
| 276 | + // For example, an 8GB VM with ~6.5GB currently available heap will yield 5 slots ((6500/800) - 3 = 5). | |
| 277 | + long slotsAvailable = (freeMemoryMB / ONE_CCM_NODE_MB) - 3; | |
| 278 | 278 | maximumWeight = Math.min(8, Math.max(1, slotsAvailable)); |
| 279 | 279 | } else { |
| 280 | 280 | maximumWeight = Integer.parseInt(numberOfNodes); |
modified driver-core/src/test/java/com/datastax/driver/core/HostAssert.java +14 −3
| @@ -21,9 +21,11 @@ | ||
| 21 | 21 | import org.assertj.core.api.AbstractAssert; |
| 22 | 22 | |
| 23 | 23 | import java.net.InetAddress; |
| 24 | +import java.util.concurrent.Callable; | |
| 24 | 25 | import java.util.concurrent.CountDownLatch; |
| 25 | 26 | import java.util.concurrent.TimeUnit; |
| 26 | 27 | |
| 28 | +import static com.datastax.driver.core.ConditionChecker.check; | |
| 27 | 29 | import static org.assertj.core.api.Assertions.assertThat; |
| 28 | 30 | import static org.assertj.core.api.Assertions.fail; |
| 29 | 31 | |
| @@ -73,9 +75,18 @@ | ||
| 73 | 75 | } |
| 74 | 76 | |
| 75 | 77 | public HostAssert isNotReconnectingFromDown() { |
| 76 | - assertThat(actual.getReconnectionAttemptFuture() != null && !actual.getReconnectionAttemptFuture().isDone()) | |
| 77 | - .isFalse(); | |
| 78 | - return this; | |
| 78 | + // Ensure that host is not attempting a reconnect. Because of JAVA-970 we cannot | |
| 79 | + // be sure that there is a race and another pool is created before the host is marked down so we | |
| 80 | + // check to see it stops after 30 seconds. | |
| 81 | + // TODO: Change this to check only once if JAVA-970 is fixed. | |
| 82 | + check().before(30, TimeUnit.SECONDS).that(new Callable<Boolean>() { | |
| 83 | + @Override | |
| 84 | + public Boolean call() throws Exception { | |
| 85 | + // Whether or not host is down and reconnection attempt is in progress. | |
| 86 | + return actual.getReconnectionAttemptFuture() != null && !actual.getReconnectionAttemptFuture().isDone(); | |
| 87 | + } | |
| 88 | + }).becomesFalse(); | |
| 89 | + return this.isDown(); | |
| 79 | 90 | } |
| 80 | 91 | |
| 81 | 92 | public HostAssert comesUpWithin(long duration, TimeUnit unit) { |