Skip to content

Commit 4769101

Browse files
committed
Merge branch '3.x' (at 3.11.5) into scylla-3.x
Update to 3.11.5 from upstream repo.
2 parents 5abdcb1 + 7fd265f commit 4769101

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+705
-82
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ not yet have been released. You can find the documentation for the latest
66
version through the [Java driver
77
docs](https://docs.scylladb.com/using-scylla/scylla-java-driver/) or via the release tags,
88
[e.g.
9-
3.11.4.0](https://github.com/scylladb/java-driver/releases/tag/3.11.4.0).*
9+
3.11.5.0](https://github.com/scylladb/java-driver/releases/tag/3.11.5.0).*
1010

1111
A modern, [feature-rich](manual/) and highly tunable Java client
1212
library for Apache Cassandra (2.1+) and using exclusively Cassandra's binary protocol
@@ -62,7 +62,7 @@ it in your application using the following Maven dependency
6262
<dependency>
6363
<groupId>com.scylladb</groupId>
6464
<artifactId>scylla-driver-core</artifactId>
65-
<version>3.11.4.0</version>
65+
<version>3.11.5.0</version>
6666
</dependency>
6767
```
6868

@@ -72,7 +72,7 @@ Note that the object mapper is published as a separate artifact:
7272
<dependency>
7373
<groupId>com.scylladb</groupId>
7474
<artifactId>scylla-driver-mapping</artifactId>
75-
<version>3.11.4.0</version>
75+
<version>3.11.5.0</version>
7676
</dependency>
7777
```
7878

@@ -82,7 +82,7 @@ The 'extras' module is also published as a separate artifact:
8282
<dependency>
8383
<groupId>com.scylladb</groupId>
8484
<artifactId>scylla-driver-extras</artifactId>
85-
<version>3.11.4.0</version>
85+
<version>3.11.5.0</version>
8686
</dependency>
8787
```
8888

@@ -92,7 +92,7 @@ to avoid the explicit dependency to Netty.
9292

9393
## Compatibility
9494

95-
The Java client driver 3.11.4.0 ([branch scylla-3.x](https://github.com/scylladb/java-driver/tree/scylla-3.x)) is compatible with
95+
The Java client driver 3.11.5.0 ([branch scylla-3.x](https://github.com/scylladb/java-driver/tree/scylla-3.x)) is compatible with
9696
Scylla and Apache Cassandra 2.1, 2.2, 3.0+.
9797

9898
UDT and tuple support is available only when using Apache Cassandra 2.1 or higher.

changelog/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
3.x versions get published.
66
-->
77

8+
### 3.11.5
9+
- [improvement] JAVA-3114: Shade io.dropwizard.metrics:metrics-core in shaded driver
10+
- [improvement] JAVA-3115: SchemaChangeListener#onKeyspaceChanged can fire when keyspace has not changed if using SimpleStrategy replication
11+
812
### 3.11.4
913
- [improvement] JAVA-3079: Upgrade Netty to 4.1.94, 3.x edition
1014
- [improvement] JAVA-3082: Fix maven build for Apple-silicon

driver-core/pom.xml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<parent>
2727
<groupId>com.scylladb</groupId>
2828
<artifactId>scylla-driver-parent</artifactId>
29-
<version>3.11.4.1-SNAPSHOT</version>
29+
<version>3.11.5.0-SNAPSHOT</version>
3030
</parent>
3131

3232
<artifactId>scylla-driver-core</artifactId>
@@ -287,8 +287,9 @@
287287
JNR does not provide OSGi bundles, so exclude it; the driver can live without it
288288
Explicitly import javax.security.cert because it's required by Netty, but Netty has been explicitly excluded
289289
-->
290-
<Import-Package><![CDATA[com.google.common.*;version="16.0.1",!jnr.*,!io.netty.*,javax.security.cert,*]]></Import-Package>
290+
<Import-Package><![CDATA[com.google.common.*;version="16.0.1",!jnr.*,!io.netty.*,!com.codahale.metrics,javax.security.cert,javax.management,*]]></Import-Package>
291291
<Private-Package>com.datastax.shaded.*</Private-Package>
292+
<Export-Package>com.datastax.shaded.metrics;*</Export-Package>
292293
</instructions>
293294
</configuration>
294295
</execution>
@@ -302,6 +303,7 @@
302303
<artifactSet>
303304
<includes>
304305
<include>io.netty:*</include>
306+
<include>io.dropwizard.metrics:metrics-core</include>
305307
</includes>
306308
<excludes>
307309
<exclude>io.netty:netty-transport-native-epoll</exclude>
@@ -312,6 +314,10 @@
312314
<pattern>io.netty</pattern>
313315
<shadedPattern>com.datastax.shaded.netty</shadedPattern>
314316
</relocation>
317+
<relocation>
318+
<pattern>com.codahale.metrics</pattern>
319+
<shadedPattern>com.datastax.shaded.metrics</shadedPattern>
320+
</relocation>
315321
</relocations>
316322
<transformers>
317323
<transformer implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
@@ -328,6 +334,8 @@
328334
<resource>META-INF/maven/io.netty/netty-handler/pom.xml</resource>
329335
<resource>META-INF/maven/io.netty/netty-transport/pom.properties</resource>
330336
<resource>META-INF/maven/io.netty/netty-transport/pom.xml</resource>
337+
<resource>META-INF/maven/io.dropwizard.metrics/metrics-core/pom.properties</resource>
338+
<resource>META-INF/maven/io.dropwizard.metrics/metrics-core/pom.xml</resource>
331339
</resources>
332340
</transformer>
333341
<!-- Pick up the alternate manifest that was generated by the alternate execution of the bundle plugin -->

driver-core/src/main/java/com/datastax/driver/core/ReplicationStategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public boolean equals(Object o) {
106106

107107
SimpleStrategy that = (SimpleStrategy) o;
108108

109-
return replicationFactor == that.replicationFactor;
109+
return replicationFactor.equals(that.replicationFactor);
110110
}
111111

112112
@Override

driver-core/src/test/java/com/datastax/driver/core/CCMTestsSupport.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
import org.slf4j.Logger;
6363
import org.slf4j.LoggerFactory;
6464
import org.testng.ITestResult;
65+
import org.testng.SkipException;
6566
import org.testng.annotations.AfterClass;
6667
import org.testng.annotations.AfterMethod;
6768
import org.testng.annotations.BeforeClass;
@@ -1181,4 +1182,17 @@ private static <T> T instantiate(Class<? extends T> clazz)
11811182
return (T) constructor.newInstance(enclosingInstance);
11821183
}
11831184
}
1185+
1186+
protected boolean isCassandraVersionOrHigher(String version) {
1187+
return CCMBridge.getGlobalCassandraVersion().compareTo(VersionNumber.parse(version)) >= 0;
1188+
}
1189+
1190+
protected void skipTestWithCassandraVersionOrHigher(String version, String testKind) {
1191+
if (isCassandraVersionOrHigher(version)) {
1192+
throw new SkipException(
1193+
String.format(
1194+
"%s tests not applicable to cassandra version >= %s (configured: %s)",
1195+
testKind, version, CCMBridge.getGlobalCassandraVersion()));
1196+
}
1197+
}
11841198
}

driver-core/src/test/java/com/datastax/driver/core/ClusterInitTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ public void should_handle_failing_or_missing_contact_points() throws UnknownHost
113113
cluster =
114114
Cluster.builder()
115115
.withPort(scassandra.getBinaryPort())
116+
// scassandra supports max V4 protocol
117+
.withProtocolVersion(ProtocolVersion.V4)
116118
.addContactPoints(
117119
ipOfNode(1),
118120
failingHosts.get(0).address,

driver-core/src/test/java/com/datastax/driver/core/DirectCompressionTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public class DirectCompressionTest extends CompressionTest {
2929
*/
3030
@Test(groups = "short")
3131
public void should_function_with_snappy_compression() throws Exception {
32+
skipTestWithCassandraVersionOrHigher("4.0.0", "snappy");
3233
compressionTest(ProtocolOptions.Compression.SNAPPY);
3334
}
3435

driver-core/src/test/java/com/datastax/driver/core/FrameLengthTest.java

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import com.datastax.driver.core.querybuilder.Insert;
2727
import com.datastax.driver.core.schemabuilder.Create;
2828
import com.datastax.driver.core.schemabuilder.SchemaBuilder;
29+
import com.datastax.driver.core.utils.CassandraVersion;
2930
import java.nio.ByteBuffer;
3031
import java.util.Collection;
3132
import java.util.Random;
@@ -105,22 +106,42 @@ public void onTestContextInitialized() {
105106
*/
106107
@Test(groups = "isolated")
107108
public void should_throw_exception_when_frame_exceeds_configured_max() {
109+
skipTestWithCassandraVersionOrHigher("4.0.0", "frame-size exceeding with default-protocol");
110+
run_frame_size_exceeding_queries(session());
111+
}
112+
113+
/**
114+
* With cassandra 4.0.0+, V5 protocol is default which breaks requests into segments. Force V4
115+
* protocol to allow us to test frame-size limitation code.
116+
*/
117+
@CassandraVersion("4.0.0")
118+
@Test(groups = "isolated")
119+
public void should_throw_exception_when_frame_exceeds_configured_max_v4_protocol_cassandra4() {
120+
Cluster cluster =
121+
register(createClusterBuilder().withProtocolVersion(ProtocolVersion.V4).build());
122+
Session session = register(cluster.connect());
123+
useKeyspace(session, keyspace);
124+
125+
run_frame_size_exceeding_queries(session);
126+
}
127+
128+
private void run_frame_size_exceeding_queries(Session session) {
108129
try {
109-
session().execute(select().from(tableName).where(eq("k", 0)));
130+
session.execute(select().from(tableName).where(eq("k", 0)));
110131
fail("Exception expected");
111132
} catch (FrameTooLongException ftle) {
112133
// Expected.
113134
}
114135

115136
// Both hosts should remain up.
116-
Collection<Host> hosts = session().getState().getConnectedHosts();
137+
Collection<Host> hosts = session.getState().getConnectedHosts();
117138
assertThat(hosts).hasSize(2).extractingResultOf("isUp").containsOnly(true);
118139

119140
// Should be able to make a query that is less than the max frame size.
120141
// Execute multiple time to exercise all hosts.
121142
for (int i = 0; i < 10; i++) {
122143
ResultSet result =
123-
session().execute(select().from(tableName).where(eq("k", 0)).and(eq("c", 0)));
144+
session.execute(select().from(tableName).where(eq("k", 0)).and(eq("c", 0)));
124145
assertThat(result.getAvailableWithoutFetching()).isEqualTo(1);
125146
}
126147
}

driver-core/src/test/java/com/datastax/driver/core/HeapCompressionTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public void beforeTestClass() throws Exception {
3737
*/
3838
@Test(groups = "isolated")
3939
public void should_function_with_snappy_compression() throws Exception {
40+
skipTestWithCassandraVersionOrHigher("4.0.0", "snappy");
4041
compressionTest(ProtocolOptions.Compression.SNAPPY);
4142
}
4243

driver-core/src/test/java/com/datastax/driver/core/LoadBalancingPolicyBootstrapTest.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ public void should_init_policy_with_up_contact_points() throws Exception {
6565
try {
6666
cluster.init();
6767

68+
// To support astra, only hosts in Metadata#getContactPoints are passed to init()
69+
// TestUtils#configureClusterBuilder only uses the first host as the contact point
70+
// Remaining hosts are learned after connection via onAdd()
6871
assertThat(policy.history)
6972
.containsOnly(
7073
entry(INIT, TestUtils.findHost(cluster, 1)),
@@ -104,8 +107,16 @@ public void should_send_down_notifications_after_init_when_contact_points_are_do
104107
ccm().stop(nodeToStop);
105108
ccm().waitForDown(nodeToStop);
106109

110+
// usually only one contact point is used to build the test cluster
111+
// here we explicitly add both endpoints so we can test load
112+
// balancing initial connection when the first connection point is down
107113
HistoryPolicy policy = new HistoryPolicy(new RoundRobinPolicy());
108-
Cluster cluster = register(createClusterBuilder().withLoadBalancingPolicy(policy).build());
114+
Cluster cluster =
115+
register(
116+
createClusterBuilder()
117+
.addContactPoints(ccm().getContactPoints().get(1))
118+
.withLoadBalancingPolicy(policy)
119+
.build());
109120

110121
try {
111122
cluster.init();

0 commit comments

Comments
 (0)