Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
3.x versions get published.
-->

### 3.11.0 (in progress)

- [improvement] JAVA-2705: Remove protocol v5 beta status, add v6-beta.

## 3.10.2

- [bug] JAVA-2860: Avoid NPE if channel initialization crashes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ public int requestSizeInBytes(ProtocolVersion protocolVersion, CodecRegistry cod
case V3:
case V4:
case V5:
case V6:
size += CBUtil.sizeOfConsistencyLevel(getConsistencyLevel());
size += QueryFlag.serializedSize(protocolVersion);
// Serial CL and default timestamp also depend on session-level defaults (QueryOptions).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ public int requestSizeInBytes(ProtocolVersion protocolVersion, CodecRegistry cod
case V3:
case V4:
case V5:
case V6:
size += CBUtil.sizeOfConsistencyLevel(getConsistencyLevel());
size += QueryFlag.serializedSize(protocolVersion);
if (wrapper.values.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public static int readSize(ByteBuffer input, ProtocolVersion version) {
case V3:
case V4:
case V5:
case V6:
return input.getInt();
default:
throw version.unsupported();
Expand Down Expand Up @@ -92,6 +93,7 @@ public static void writeSize(ByteBuffer output, int size, ProtocolVersion versio
case V3:
case V4:
case V5:
case V6:
output.putInt(size);
break;
default:
Expand Down Expand Up @@ -131,6 +133,7 @@ public static void writeValue(ByteBuffer output, ByteBuffer value, ProtocolVersi
case V3:
case V4:
case V5:
case V6:
if (value == null) {
output.putInt(-1);
} else {
Expand Down Expand Up @@ -217,6 +220,7 @@ private static int sizeOfCollectionSize(ProtocolVersion version) {
case V3:
case V4:
case V5:
case V6:
return 4;
default:
throw version.unsupported();
Expand All @@ -237,6 +241,7 @@ private static int sizeOfValue(ByteBuffer value, ProtocolVersion version) {
case V3:
case V4:
case V5:
case V6:
return value == null ? 4 : 4 + value.remaining();
default:
throw version.unsupported();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ public ListenableFuture<Void> apply(Message.Response response) throws Exception
case V3:
case V4:
case V5:
case V6:
return authenticateV2(authenticator, protocolVersion, initExecutor);
default:
throw defunct(protocolVersion.unsupported());
Expand Down Expand Up @@ -1659,6 +1660,8 @@ private static class Initializer extends ChannelInitializer<SocketChannel> {
new Message.ProtocolEncoder(ProtocolVersion.V4);
private static final Message.ProtocolEncoder messageEncoderV5 =
new Message.ProtocolEncoder(ProtocolVersion.V5);
private static final Message.ProtocolEncoder messageEncoderV6 =
new Message.ProtocolEncoder(ProtocolVersion.V6);
private static final Frame.Encoder frameEncoder = new Frame.Encoder();

private final ProtocolVersion protocolVersion;
Expand Down Expand Up @@ -1756,6 +1759,8 @@ private Message.ProtocolEncoder messageEncoderFor(ProtocolVersion version) {
return messageEncoderV4;
case V5:
return messageEncoderV5;
case V6:
return messageEncoderV6;
default:
throw new DriverInternalError("Unsupported protocol version " + protocolVersion);
}
Expand All @@ -1769,7 +1774,6 @@ private Message.ProtocolEncoder messageEncoderFor(ProtocolVersion version) {
*/
void switchToV5Framing() {
assert factory.protocolVersion.compareTo(ProtocolVersion.V5) >= 0;

// We want to do this on the event loop, to make sure it doesn't race with incoming requests
assert channel.eventLoop().inEventLoop();

Expand Down
3 changes: 3 additions & 0 deletions driver-core/src/main/java/com/datastax/driver/core/Frame.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ private static int readStreamId(ByteBuf fullFrame, ProtocolVersion version) {
case V3:
case V4:
case V5:
case V6:
return fullFrame.readShort();
default:
throw version.unsupported();
Expand Down Expand Up @@ -156,6 +157,7 @@ static int lengthFor(ProtocolVersion version) {
case V3:
case V4:
case V5:
case V6:
return 9;
default:
throw version.unsupported();
Expand All @@ -174,6 +176,7 @@ public void encodeInto(ByteBuf destination) {
case V3:
case V4:
case V5:
case V6:
destination.writeShort(streamId);
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ static SchemaChange deserializeEvent(ByteBuf bb, ProtocolVersion version) {
case V3:
case V4:
case V5:
case V6:
change = CBUtil.readEnumValue(Change.class, bb);
targetType = CBUtil.readEnumValue(SchemaElement.class, bb);
targetKeyspace = CBUtil.readString(bb);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ enum ProtocolFeature {
boolean isSupportedBy(ProtocolVersion version) {
switch (this) {
case PREPARED_METADATA_CHANGES:
return version == ProtocolVersion.V5;
return version.compareTo(ProtocolVersion.V5) >= 0;
case CUSTOM_PAYLOADS:
return version.compareTo(ProtocolVersion.V4) >= 0;
case CLIENT_TIMESTAMPS:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ public enum ProtocolVersion {
V2("2.0.0", 2, V1),
V3("2.1.0", 3, V2),
V4("2.2.0", 4, V3),
V5("3.10.0", 5, V4);
V5("4.0.0", 5, V4),
V6("4.0.0", 6, V5);

/** The most recent protocol version supported by the driver. */
public static final ProtocolVersion NEWEST_SUPPORTED = V4;
public static final ProtocolVersion NEWEST_SUPPORTED = V5;

/** The most recent beta protocol version supported by the driver. */
public static final ProtocolVersion NEWEST_BETA = V5;
public static final ProtocolVersion NEWEST_BETA = V6;

private final VersionNumber minCassandraVersion;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ public int requestSizeInBytes(ProtocolVersion protocolVersion, CodecRegistry cod
case V3:
case V4:
case V5:
case V6:
size += CBUtil.sizeOfConsistencyLevel(getConsistencyLevel());
size += QueryFlag.serializedSize(protocolVersion);
if (hasValues()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ void encode(ByteBuf dest, ProtocolVersion version) {
case V3:
case V4:
case V5:
case V6:
CBUtil.writeConsistencyLevel(consistency, dest);
QueryFlag.serialize(flags, dest, version);
if (flags.contains(QueryFlag.VALUES)) {
Expand Down Expand Up @@ -425,6 +426,7 @@ int encodedSize(ProtocolVersion version) {
case V3:
case V4:
case V5:
case V6:
int size = 0;
size += CBUtil.sizeOfConsistencyLevel(consistency);
size += QueryFlag.serializedSize(version);
Expand Down Expand Up @@ -596,6 +598,7 @@ void encode(ByteBuf dest, ProtocolVersion version) {
case V3:
case V4:
case V5:
case V6:
CBUtil.writeConsistencyLevel(consistency, dest);
QueryFlag.serialize(flags, dest, version);
if (flags.contains(QueryFlag.SERIAL_CONSISTENCY))
Expand All @@ -616,6 +619,7 @@ int encodedSize(ProtocolVersion version) {
case V3:
case V4:
case V5:
case V6:
int size = 0;
size += CBUtil.sizeOfConsistencyLevel(consistency);
size += QueryFlag.serializedSize(version);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ private Metadata decodeResultMetadata(
case V3:
case V4:
case V5:
case V6:
return Rows.Metadata.decode(body, version, codecRegistry);
default:
throw version.unsupported();
Expand Down Expand Up @@ -679,6 +680,7 @@ public Result decode(
case V3:
case V4:
case V5:
case V6:
change = CBUtil.readEnumValue(Change.class, body);
targetType = CBUtil.readEnumValue(SchemaElement.class, body);
targetKeyspace = CBUtil.readString(body);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ private static int streamIdSizeFor(ProtocolVersion version) {
case V3:
case V4:
case V5:
case V6:
return 2;
default:
throw version.unsupported();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package com.datastax.driver.core;

import static com.datastax.driver.core.ProtocolVersion.V4;
import static com.datastax.driver.core.ProtocolVersion.V5;
import static com.datastax.driver.core.ProtocolVersion.V6;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;

Expand Down Expand Up @@ -85,7 +85,7 @@ public void should_not_initialize_when_beta_flag_is_set_and_version_explicitly_r

/**
* Verifies that the driver CANNOT connect to 3.10 with the following combination of options:
* Version V5 Flag UNSET
* Version V6 Flag UNSET
*
* @jira_ticket JAVA-1248
*/
Expand All @@ -96,7 +96,7 @@ public void should_not_connect_when_beta_version_explicitly_required_and_flag_no
Cluster.builder()
.addContactPoints(getContactPoints())
.withPort(ccm().getBinaryPort())
.withProtocolVersion(V5)
.withProtocolVersion(V6)
.build();
fail("Expected IllegalArgumentException");
} catch (IllegalArgumentException e) {
Expand Down Expand Up @@ -127,7 +127,7 @@ public void should_connect_with_beta_when_no_version_explicitly_required_and_fla
.allowBetaProtocolVersion()
.build();
cluster.connect();
assertThat(cluster.getConfiguration().getProtocolOptions().getProtocolVersion()).isEqualTo(V5);
assertThat(cluster.getConfiguration().getProtocolOptions().getProtocolVersion()).isEqualTo(V6);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import static com.datastax.driver.core.ProtocolVersion.V1;
import static com.datastax.driver.core.ProtocolVersion.V4;
import static com.datastax.driver.core.ProtocolVersion.V5;
import static com.datastax.driver.core.ProtocolVersion.V6;
import static org.assertj.core.api.Assertions.assertThat;

import com.datastax.driver.core.exceptions.UnsupportedProtocolVersionException;
Expand Down Expand Up @@ -67,11 +67,11 @@ public void should_fail_when_version_provided_and_too_high() throws Exception {
/** @jira_ticket JAVA-1367 */
@Test(groups = "short")
public void should_fail_when_beta_allowed_and_too_high() throws Exception {
if (ccm().getCassandraVersion().compareTo(VersionNumber.parse("3.10")) >= 0) {
throw new SkipException("Server supports protocol protocol V5 beta");
if (ccm().getCassandraVersion().compareTo(VersionNumber.parse("4.0.0")) >= 0) {
throw new SkipException("Server supports protocol protocol V6 beta");
}
UnsupportedProtocolVersionException e = connectWithUnsupportedBetaVersion();
assertThat(e.getUnsupportedVersion()).isEqualTo(V5);
assertThat(e.getUnsupportedVersion()).isEqualTo(V6);
}

/** @jira_ticket JAVA-1367 */
Expand Down