kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 7b731983d1f2c51713805d8595600416ac4b5b6a6ab3978f7531df14f0778664 |
|---|---|
| Author | Alexandre Dutra <alexandre.dutra@datastax.com> · 2016-05-12 10:38 +02:00 |
| Committer | olim7t <omichallat+github@gmail.com> · 2016-07-08 09:06 -07:00 |
| Parents | 7518b703ac63 |
8 files changed
modified changelog/README.md +1 −0
| @@ -19,6 +19,7 @@ | ||
| 19 | 19 | - [bug] JAVA-1160: Fix NPE in VersionNumber.getPreReleaseLabels(). |
| 20 | 20 | - [improvement] JAVA-1126: Handle schema changes in Mapper. |
| 21 | 21 | - [bug] JAVA-1193: Refresh token and replica metadata synchronously when schema is altered. |
| 22 | +- [bug] JAVA-1120: Skip schema refresh debouncer when checking for agreement as a result of schema change made by client. | |
| 22 | 23 | |
| 23 | 24 | |
| 24 | 25 | ### 3.0.2 |
modified driver-core/src/main/java/com/datastax/driver/core/Cluster.java +9 −1
| @@ -2266,7 +2266,15 @@ | ||
| 2266 | 2266 | if (!schemaInAgreement) |
| 2267 | 2267 | logger.warn("No schema agreement from live replicas after {} s. The schema may not be up to date on some nodes.", configuration.getProtocolOptions().getMaxSchemaAgreementWaitSeconds()); |
| 2268 | 2268 | |
| 2269 | - ListenableFuture<Void> schemaReady = refreshSchema ? submitSchemaRefresh(targetType, targetKeyspace, targetName, targetSignature) : MoreFutures.VOID_SUCCESS; | |
| 2269 | + ListenableFuture<Void> schemaReady; | |
| 2270 | + if (refreshSchema) { | |
| 2271 | + schemaReady = submitSchemaRefresh(targetType, targetKeyspace, targetName, targetSignature); | |
| 2272 | + // JAVA-1120: skip debouncing delay and force immediate delivery | |
| 2273 | + if (!schemaReady.isDone()) | |
| 2274 | + schemaRefreshRequestDebouncer.scheduleImmediateDelivery(); | |
| 2275 | + } else { | |
| 2276 | + schemaReady = MoreFutures.VOID_SUCCESS; | |
| 2277 | + } | |
| 2270 | 2278 | final boolean finalSchemaInAgreement = schemaInAgreement; |
| 2271 | 2279 | schemaReady.addListener(new Runnable() { |
| 2272 | 2280 | @Override |
modified driver-core/src/main/java/com/datastax/driver/core/EventDebouncer.java +1 −1
| @@ -164,7 +164,7 @@ | ||
| 164 | 164 | return entry.future; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - private void scheduleImmediateDelivery() { | |
| 167 | + void scheduleImmediateDelivery() { | |
| 168 | 168 | cancelDelayedDelivery(); |
| 169 | 169 | |
| 170 | 170 | while (state == State.RUNNING) { |
modified driver-core/src/test/java/com/datastax/driver/core/ClusterInitTest.java +4 −4
| @@ -42,7 +42,8 @@ | ||
| 42 | 42 | import static com.datastax.driver.core.Assertions.fail; |
| 43 | 43 | import static com.datastax.driver.core.FakeHost.Behavior.THROWING_CONNECT_TIMEOUTS; |
| 44 | 44 | import static com.datastax.driver.core.HostDistance.LOCAL; |
| 45 | -import static com.datastax.driver.core.TestUtils.*; | |
| 45 | +import static com.datastax.driver.core.TestUtils.ipOfNode; | |
| 46 | +import static com.datastax.driver.core.TestUtils.nonQuietClusterCloseOptions; | |
| 46 | 47 | import static org.mockito.Mockito.*; |
| 47 | 48 | |
| 48 | 49 | public class ClusterInitTest { |
| @@ -107,7 +108,6 @@ | ||
| 107 | 108 | .withReconnectionPolicy(reconnectionPolicy) |
| 108 | 109 | .withPoolingOptions(poolingOptions) |
| 109 | 110 | .withProtocolVersion(TestUtils.getDesiredProtocolVersion()) |
| 110 | - .withQueryOptions(nonDebouncingQueryOptions()) | |
| 111 | 111 | .build(); |
| 112 | 112 | cluster.connect(); |
| 113 | 113 | |
| @@ -228,7 +228,7 @@ | ||
| 228 | 228 | ScassandraCluster scassandraCluster = ScassandraCluster.builder() |
| 229 | 229 | .withIpPrefix(TestUtils.IP_PREFIX) |
| 230 | 230 | .withNodes(5) |
| 231 | - // For node 2, report an older version which uses protocol v1. | |
| 231 | + // For node 2, report an older version which uses protocol v1. | |
| 232 | 232 | .forcePeerInfo(1, 2, "release_version", "1.2.19") |
| 233 | 233 | .build(); |
| 234 | 234 | Cluster cluster = Cluster.builder() |
| @@ -262,7 +262,7 @@ | ||
| 262 | 262 | PrimingClient.builder() |
| 263 | 263 | .withHost(ipOfNode(1)) |
| 264 | 264 | .withPort(scassandra.getAdminPort()) |
| 265 | - .build(); | |
| 265 | + .build(); | |
| 266 | 266 | |
| 267 | 267 | List<Map<String, ?>> rows = Lists.newArrayListWithCapacity(5); |
| 268 | 268 |
modified driver-core/src/test/java/com/datastax/driver/core/HostMetadataIntegrationTest.java +0 −2
| @@ -24,7 +24,6 @@ | ||
| 24 | 24 | import static com.datastax.driver.core.Assertions.assertThat; |
| 25 | 25 | import static com.datastax.driver.core.CCMAccess.Workload.solr; |
| 26 | 26 | import static com.datastax.driver.core.CCMAccess.Workload.spark; |
| 27 | -import static com.datastax.driver.core.TestUtils.nonDebouncingQueryOptions; | |
| 28 | 27 | import static com.datastax.driver.core.TestUtils.nonQuietClusterCloseOptions; |
| 29 | 28 | |
| 30 | 29 | public class HostMetadataIntegrationTest { |
| @@ -58,7 +57,6 @@ | ||
| 58 | 57 | Cluster cluster = Cluster.builder() |
| 59 | 58 | .addContactPoints(ccm.addressOfNode(1).getAddress()) |
| 60 | 59 | .withPort(ccm.getBinaryPort()) |
| 61 | - .withQueryOptions(nonDebouncingQueryOptions()) | |
| 62 | 60 | .build(); |
| 63 | 61 | try { |
| 64 | 62 | cluster.connect(); |
modified driver-core/src/test/java/com/datastax/driver/core/SchemaRefreshDebouncerTest.java +4 −1
| @@ -17,7 +17,6 @@ | ||
| 17 | 17 | |
| 18 | 18 | import org.mockito.ArgumentCaptor; |
| 19 | 19 | import org.testng.SkipException; |
| 20 | -import org.testng.annotations.AfterMethod; | |
| 21 | 20 | import org.testng.annotations.BeforeMethod; |
| 22 | 21 | import org.testng.annotations.Test; |
| 23 | 22 | |
| @@ -249,6 +248,8 @@ | ||
| 249 | 248 | String prefix = TestUtils.generateIdentifier("ks_"); |
| 250 | 249 | for (int i = 0; i < 3; i++) { |
| 251 | 250 | session().execute(String.format(CREATE_KEYSPACE_SIMPLE_FORMAT, prefix + i, 1)); |
| 251 | + // check that the metadata is immediately up-to-date for the client that issued the DDL statement | |
| 252 | + assertThat(cluster().getMetadata().getKeyspace(prefix + i)).isNotNull(); | |
| 252 | 253 | } |
| 253 | 254 | |
| 254 | 255 | verify(listener, timeout(DEBOUNCE_TIME * 3).times(3)).onKeyspaceAdded(any(KeyspaceMetadata.class)); |
| @@ -275,6 +276,8 @@ | ||
| 275 | 276 | String prefix = TestUtils.generateIdentifier("ks_"); |
| 276 | 277 | for (int i = 0; i < 5; i++) { |
| 277 | 278 | session().execute(String.format(CREATE_KEYSPACE_SIMPLE_FORMAT, prefix + i, 1)); |
| 279 | + // check that the metadata is immediately up-to-date for the client that issued the DDL statement | |
| 280 | + assertThat(cluster().getMetadata().getKeyspace(prefix + i)).isNotNull(); | |
| 278 | 281 | } |
| 279 | 282 | |
| 280 | 283 | // Event should be processed immediately as we hit our threshold. |
modified driver-core/src/test/java/com/datastax/driver/core/TokenIntegrationTest.java +1 −2
| @@ -61,8 +61,7 @@ | ||
| 61 | 61 | return Cluster.builder() |
| 62 | 62 | .addContactPoints(getContactPoints().get(0)) |
| 63 | 63 | .withPort(ccm().getBinaryPort()) |
| 64 | - .withLoadBalancingPolicy(lbp) | |
| 65 | - .withQueryOptions(TestUtils.nonDebouncingQueryOptions()); | |
| 64 | + .withLoadBalancingPolicy(lbp); | |
| 66 | 65 | } |
| 67 | 66 | |
| 68 | 67 | @Override |
modified driver-mapping/src/test/java/com/datastax/driver/mapping/MapperAsyncTest.java +1 −1
| @@ -71,7 +71,7 @@ | ||
| 71 | 71 | // create a second cluster to perform everything asynchronously, |
| 72 | 72 | // including session initialization |
| 73 | 73 | Cluster cluster2 = register( |
| 74 | - createClusterBuilderNoDebouncing() | |
| 74 | + createClusterBuilder() | |
| 75 | 75 | .addContactPoints(getContactPoints()) |
| 76 | 76 | .withPort(ccm().getBinaryPort()) |
| 77 | 77 | .build()); |