Elffuss BraidHub

kikocis/java-driver public

Prevent clients from using protocol V4 when connecting to a Scassandra server.

With V4, the server fails to properly detect the protocol version sent by the client and consequently fails to interpret the very first message received.
Changesetc5cc9d4bc65c877b5941aa386f818cdd15e62fcff3cd22d38d338c1c772b6f21
AuthorAlexandre Dutra <alexandre.dutra@datastax.com> · 2015-07-16 14:27 +02:00
CommitterAlexandre Dutra <alexandre.dutra@datastax.com> · 2015-07-16 16:10 +02:00
Parents7ac3dee01747

Browse the files at this changeset

6 files changed

modified driver-core/src/test/java/com/datastax/driver/core/RequestHandlerTest.java +5 −1
@@ -43,7 +43,11 @@
4343 .build()
4444 );
4545
46- cluster = Cluster.builder().addContactPoint("127.0.0.1").withPort(scassandra.getBinaryPort())
46+ cluster = Cluster.builder()
47+ .addContactPoint("127.0.0.1")
48+ .withPort(scassandra.getBinaryPort())
49+ // Scassandra does not support V3 nor V4 yet, and V4 may cause the server to crash
50+ .withProtocolVersion(ProtocolVersion.V2)
4751 .withPoolingOptions(new PoolingOptions()
4852 .setCoreConnectionsPerHost(HostDistance.LOCAL, 1)
4953 .setMaxConnectionsPerHost(HostDistance.LOCAL, 1)
modified driver-core/src/test/java/com/datastax/driver/core/SCassandraCluster.java +1 −1
@@ -35,7 +35,7 @@
3535 * and a CCM cluster is not running at the same time.
3636 */
3737 public class SCassandraCluster {
38- private static final int BINARY_PORT = 9042;
38+ public static final int BINARY_PORT = 9042;
3939 private static final int ADMIN_PORT = 9052;
4040
4141 private final List<Scassandra> scassandras;
modified driver-core/src/test/java/com/datastax/driver/core/ScassandraTestBase.java +1 −1
@@ -74,7 +74,7 @@
7474 protected Cluster.Builder createClusterBuilder() {
7575 Cluster.Builder builder = Cluster.builder()
7676 .addContactPoint("127.0.0.1")
77- // Scassandra does not support V3 yet
77+ // Scassandra does not support V3 yet, and V4 may cause the server to crash
7878 .withProtocolVersion(ProtocolVersion.V2)
7979 .withPoolingOptions(new PoolingOptions()
8080 .setCoreConnectionsPerHost(HostDistance.LOCAL, 1)
modified driver-core/src/test/java/com/datastax/driver/core/SpeculativeExecutionTest.java +2 −0
@@ -188,6 +188,8 @@
188188
189189 Cluster cluster = Cluster.builder()
190190 .addContactPoint(CCMBridge.ipOfNode(2))
191+ // Scassandra does not support V3 nor V4 yet, and V4 may cause the server to crash
192+ .withProtocolVersion(ProtocolVersion.V2)
191193 .withSpeculativeExecutionPolicy(mockPolicy)
192194 .build();
193195
modified driver-core/src/test/java/com/datastax/driver/core/policies/AbstractRetryPolicyIntegrationTest.java +7 −0
@@ -69,6 +69,13 @@
6969 .addContactPoint(CCMBridge.ipOfNode(1))
7070 .withRetryPolicy(retryPolicy)
7171 .withLoadBalancingPolicy(new SortingLoadBalancingPolicy())
72+ // Scassandra does not support V3 nor V4 yet, and V4 may cause the server to crash
73+ .withProtocolVersion(ProtocolVersion.V2)
74+ .withPoolingOptions(new PoolingOptions()
75+ .setCoreConnectionsPerHost(HostDistance.LOCAL, 1)
76+ .setMaxConnectionsPerHost(HostDistance.LOCAL, 1)
77+ .setHeartbeatIntervalSeconds(0))
78+ .withPort(SCassandraCluster.BINARY_PORT)
7279 .build();
7380
7481 session = cluster.connect();
modified driver-core/src/test/java/com/datastax/driver/core/policies/DefaultRetryPolicyIntegrationTest.java +3 −4
@@ -15,10 +15,7 @@
1515 */
1616 package com.datastax.driver.core.policies;
1717
18-import com.datastax.driver.core.CCMBridge;
19-import com.datastax.driver.core.Cluster;
20-import com.datastax.driver.core.Metrics;
21-import com.datastax.driver.core.Session;
18+import com.datastax.driver.core.*;
2219 import com.datastax.driver.core.exceptions.NoHostAvailableException;
2320 import org.testng.annotations.Test;
2421
@@ -110,6 +107,8 @@
110107
111108 Cluster whiteListedCluster = Cluster.builder()
112109 .addContactPoint(CCMBridge.ipOfNode(1))
110+ // Scassandra does not support V3 nor V4 yet, and V4 may cause the server to crash
111+ .withProtocolVersion(ProtocolVersion.V2)
113112 .withRetryPolicy(retryPolicy)
114113 .withLoadBalancingPolicy(firstHostOnlyPolicy)
115114 .build();