Skip to content

Commit 18ef455

Browse files
authored
JAVA-2705: Remove protocol v5 beta status, add v6-beta (#1529)
1 parent 6cb4d14 commit 18ef455

File tree

15 files changed

+41
-13
lines changed

15 files changed

+41
-13
lines changed

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.0 (in progress)
9+
10+
- [improvement] JAVA-2705: Remove protocol v5 beta status, add v6-beta.
11+
812
## 3.10.2
913

1014
- [bug] JAVA-2860: Avoid NPE if channel initialization crashes.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ public int requestSizeInBytes(ProtocolVersion protocolVersion, CodecRegistry cod
220220
case V3:
221221
case V4:
222222
case V5:
223+
case V6:
223224
size += CBUtil.sizeOfConsistencyLevel(getConsistencyLevel());
224225
size += QueryFlag.serializedSize(protocolVersion);
225226
// Serial CL and default timestamp also depend on session-level defaults (QueryOptions).

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ public int requestSizeInBytes(ProtocolVersion protocolVersion, CodecRegistry cod
321321
case V3:
322322
case V4:
323323
case V5:
324+
case V6:
324325
size += CBUtil.sizeOfConsistencyLevel(getConsistencyLevel());
325326
size += QueryFlag.serializedSize(protocolVersion);
326327
if (wrapper.values.length > 0) {

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public static int readSize(ByteBuffer input, ProtocolVersion version) {
6464
case V3:
6565
case V4:
6666
case V5:
67+
case V6:
6768
return input.getInt();
6869
default:
6970
throw version.unsupported();
@@ -92,6 +93,7 @@ public static void writeSize(ByteBuffer output, int size, ProtocolVersion versio
9293
case V3:
9394
case V4:
9495
case V5:
96+
case V6:
9597
output.putInt(size);
9698
break;
9799
default:
@@ -131,6 +133,7 @@ public static void writeValue(ByteBuffer output, ByteBuffer value, ProtocolVersi
131133
case V3:
132134
case V4:
133135
case V5:
136+
case V6:
134137
if (value == null) {
135138
output.putInt(-1);
136139
} else {
@@ -217,6 +220,7 @@ private static int sizeOfCollectionSize(ProtocolVersion version) {
217220
case V3:
218221
case V4:
219222
case V5:
223+
case V6:
220224
return 4;
221225
default:
222226
throw version.unsupported();
@@ -237,6 +241,7 @@ private static int sizeOfValue(ByteBuffer value, ProtocolVersion version) {
237241
case V3:
238242
case V4:
239243
case V5:
244+
case V6:
240245
return value == null ? 4 : 4 + value.remaining();
241246
default:
242247
throw version.unsupported();

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ public ListenableFuture<Void> apply(Message.Response response) throws Exception
394394
case V3:
395395
case V4:
396396
case V5:
397+
case V6:
397398
return authenticateV2(authenticator, protocolVersion, initExecutor);
398399
default:
399400
throw defunct(protocolVersion.unsupported());
@@ -1659,6 +1660,8 @@ private static class Initializer extends ChannelInitializer<SocketChannel> {
16591660
new Message.ProtocolEncoder(ProtocolVersion.V4);
16601661
private static final Message.ProtocolEncoder messageEncoderV5 =
16611662
new Message.ProtocolEncoder(ProtocolVersion.V5);
1663+
private static final Message.ProtocolEncoder messageEncoderV6 =
1664+
new Message.ProtocolEncoder(ProtocolVersion.V6);
16621665
private static final Frame.Encoder frameEncoder = new Frame.Encoder();
16631666

16641667
private final ProtocolVersion protocolVersion;
@@ -1756,6 +1759,8 @@ private Message.ProtocolEncoder messageEncoderFor(ProtocolVersion version) {
17561759
return messageEncoderV4;
17571760
case V5:
17581761
return messageEncoderV5;
1762+
case V6:
1763+
return messageEncoderV6;
17591764
default:
17601765
throw new DriverInternalError("Unsupported protocol version " + protocolVersion);
17611766
}
@@ -1769,7 +1774,6 @@ private Message.ProtocolEncoder messageEncoderFor(ProtocolVersion version) {
17691774
*/
17701775
void switchToV5Framing() {
17711776
assert factory.protocolVersion.compareTo(ProtocolVersion.V5) >= 0;
1772-
17731777
// We want to do this on the event loop, to make sure it doesn't race with incoming requests
17741778
assert channel.eventLoop().inEventLoop();
17751779

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ private static int readStreamId(ByteBuf fullFrame, ProtocolVersion version) {
106106
case V3:
107107
case V4:
108108
case V5:
109+
case V6:
109110
return fullFrame.readShort();
110111
default:
111112
throw version.unsupported();
@@ -156,6 +157,7 @@ static int lengthFor(ProtocolVersion version) {
156157
case V3:
157158
case V4:
158159
case V5:
160+
case V6:
159161
return 9;
160162
default:
161163
throw version.unsupported();
@@ -174,6 +176,7 @@ public void encodeInto(ByteBuf destination) {
174176
case V3:
175177
case V4:
176178
case V5:
179+
case V6:
177180
destination.writeShort(streamId);
178181
break;
179182
default:

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ static SchemaChange deserializeEvent(ByteBuf bb, ProtocolVersion version) {
155155
case V3:
156156
case V4:
157157
case V5:
158+
case V6:
158159
change = CBUtil.readEnumValue(Change.class, bb);
159160
targetType = CBUtil.readEnumValue(SchemaElement.class, bb);
160161
targetKeyspace = CBUtil.readString(bb);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ enum ProtocolFeature {
4242
boolean isSupportedBy(ProtocolVersion version) {
4343
switch (this) {
4444
case PREPARED_METADATA_CHANGES:
45-
return version == ProtocolVersion.V5;
45+
return version.compareTo(ProtocolVersion.V5) >= 0;
4646
case CUSTOM_PAYLOADS:
4747
return version.compareTo(ProtocolVersion.V4) >= 0;
4848
case CLIENT_TIMESTAMPS:

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@ public enum ProtocolVersion {
2626
V2("2.0.0", 2, V1),
2727
V3("2.1.0", 3, V2),
2828
V4("2.2.0", 4, V3),
29-
V5("3.10.0", 5, V4);
29+
V5("4.0.0", 5, V4),
30+
V6("4.0.0", 6, V5);
3031

3132
/** The most recent protocol version supported by the driver. */
32-
public static final ProtocolVersion NEWEST_SUPPORTED = V4;
33+
public static final ProtocolVersion NEWEST_SUPPORTED = V5;
3334

3435
/** The most recent beta protocol version supported by the driver. */
35-
public static final ProtocolVersion NEWEST_BETA = V5;
36+
public static final ProtocolVersion NEWEST_BETA = V6;
3637

3738
private final VersionNumber minCassandraVersion;
3839

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ public int requestSizeInBytes(ProtocolVersion protocolVersion, CodecRegistry cod
194194
case V3:
195195
case V4:
196196
case V5:
197+
case V6:
197198
size += CBUtil.sizeOfConsistencyLevel(getConsistencyLevel());
198199
size += QueryFlag.serializedSize(protocolVersion);
199200
if (hasValues()) {

0 commit comments

Comments
 (0)