You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ty...@apache.org on 2016/04/05 21:05:22 UTC
[1/2] cassandra git commit: Respond with ProtocolError to v1/v2
message header
Repository: cassandra
Updated Branches:
refs/heads/trunk 87fdc9b66 -> ce747b850
Respond with ProtocolError to v1/v2 message header
Patch by Tyler Hobbs; reviewed by Sandeep Tamhankar for CASSANDRA-11464
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/1681c18c
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/1681c18c
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/1681c18c
Branch: refs/heads/trunk
Commit: 1681c18c2f2c1be8d4c1b68c787097e8a1a23fa1
Parents: ac6ca9c
Author: Tyler Hobbs <ty...@gmail.com>
Authored: Tue Apr 5 14:02:18 2016 -0500
Committer: Tyler Hobbs <ty...@gmail.com>
Committed: Tue Apr 5 14:02:18 2016 -0500
----------------------------------------------------------------------
CHANGES.txt | 2 ++
.../org/apache/cassandra/transport/Frame.java | 11 +++++++---
.../cassandra/transport/ProtocolErrorTest.java | 23 ++++++++++++++++++++
3 files changed, 33 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1681c18c/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 4baaa30..8f4329a 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,6 @@
3.0.6
+ * Properly respond with ProtocolError when a v1/v2 native protocol
+ header is received (CASSANDRA-11464)
* Validate that num_tokens and initial_token are consistent with one another (CASSANDRA-10120)
Merged from 2.2:
* IncomingStreamingConnection version check message wrong (CASSANDRA-11462)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1681c18c/src/java/org/apache/cassandra/transport/Frame.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/transport/Frame.java b/src/java/org/apache/cassandra/transport/Frame.java
index 04cc95e..363ff76 100644
--- a/src/java/org/apache/cassandra/transport/Frame.java
+++ b/src/java/org/apache/cassandra/transport/Frame.java
@@ -162,20 +162,25 @@ public class Frame
return;
}
- // Wait until we have the complete header
- if (buffer.readableBytes() < Header.LENGTH)
+ int readableBytes = buffer.readableBytes();
+ if (readableBytes == 0)
return;
int idx = buffer.readerIndex();
+ // Check the first byte for the protocol version before we wait for a complete header. Protocol versions
+ // 1 and 2 use a shorter header, so we may never have a complete header's worth of bytes.
int firstByte = buffer.getByte(idx++);
Message.Direction direction = Message.Direction.extractFromVersion(firstByte);
int version = firstByte & PROTOCOL_VERSION_MASK;
-
if (version < Server.MIN_SUPPORTED_VERSION || version > Server.CURRENT_VERSION)
throw new ProtocolException(String.format("Invalid or unsupported protocol version (%d); the lowest supported version is %d and the greatest is %d",
version, Server.MIN_SUPPORTED_VERSION, Server.CURRENT_VERSION));
+ // Wait until we have the complete header
+ if (readableBytes < Header.LENGTH)
+ return;
+
int flags = buffer.getByte(idx++);
int streamId = buffer.getShort(idx);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1681c18c/test/unit/org/apache/cassandra/transport/ProtocolErrorTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/transport/ProtocolErrorTest.java b/test/unit/org/apache/cassandra/transport/ProtocolErrorTest.java
index de21bb1..599087c 100644
--- a/test/unit/org/apache/cassandra/transport/ProtocolErrorTest.java
+++ b/test/unit/org/apache/cassandra/transport/ProtocolErrorTest.java
@@ -68,6 +68,29 @@ public class ProtocolErrorTest {
}
@Test
+ public void testInvalidProtocolVersionShortFrame() throws Exception
+ {
+ // test for CASSANDRA-11464
+ Frame.Decoder dec = new Frame.Decoder(null);
+
+ List<Object> results = new ArrayList<>();
+ byte[] frame = new byte[] {
+ (byte) REQUEST.addToVersion(1), // direction & version
+ 0x00, // flags
+ 0x01, // stream ID
+ 0x09, // opcode
+ 0x00, 0x00, 0x00, 0x21, // body length
+ };
+ ByteBuf buf = Unpooled.wrappedBuffer(frame);
+ try {
+ dec.decode(null, buf, results);
+ Assert.fail("Expected protocol error");
+ } catch (ProtocolException e) {
+ Assert.assertTrue(e.getMessage().contains("Invalid or unsupported protocol version"));
+ }
+ }
+
+ @Test
public void testInvalidDirection() throws Exception
{
Frame.Decoder dec = new Frame.Decoder(null);
[2/2] cassandra git commit: Merge branch 'cassandra-3.0' into trunk
Posted by ty...@apache.org.
Merge branch 'cassandra-3.0' into trunk
Conflicts:
CHANGES.txt
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/ce747b85
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/ce747b85
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/ce747b85
Branch: refs/heads/trunk
Commit: ce747b8505d86992f09220390f78c39c4f716e06
Parents: 87fdc9b 1681c18
Author: Tyler Hobbs <ty...@gmail.com>
Authored: Tue Apr 5 14:04:49 2016 -0500
Committer: Tyler Hobbs <ty...@gmail.com>
Committed: Tue Apr 5 14:04:49 2016 -0500
----------------------------------------------------------------------
CHANGES.txt | 2 ++
.../org/apache/cassandra/transport/Frame.java | 11 +++++++---
.../cassandra/transport/ProtocolErrorTest.java | 23 ++++++++++++++++++++
3 files changed, 33 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/ce747b85/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index f30210a,8f4329a..05fda52
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,38 -1,6 +1,40 @@@
-3.0.6
+3.6
+ * More user friendly error when providing an invalid token to nodetool (CASSANDRA-9348)
+ * Add static column support to SASI index (CASSANDRA-11183)
+ * Support EQ/PREFIX queries in SASI CONTAINS mode without tokenization (CASSANDRA-11434)
+ * Support LIKE operator in prepared statements (CASSANDRA-11456)
+ * Add a command to see if a Materialized View has finished building (CASSANDRA-9967)
+ * Log endpoint and port associated with streaming operation (CASSANDRA-8777)
+ * Print sensible units for all log messages (CASSANDRA-9692)
+ * Upgrade Netty to version 4.0.34 (CASSANDRA-11096)
+ * Break the CQL grammar into separate Parser and Lexer (CASSANDRA-11372)
+ * Compress only inter-dc traffic by default (CASSANDRA-8888)
+ * Add metrics to track write amplification (CASSANDRA-11420)
+ * cassandra-stress: cannot handle "value-less" tables (CASSANDRA-7739)
+ * Add/drop multiple columns in one ALTER TABLE statement (CASSANDRA-10411)
+ * Add require_endpoint_verification opt for internode encryption (CASSANDRA-9220)
+ * Add auto import java.util for UDF code block (CASSANDRA-11392)
+ * Add --hex-format option to nodetool getsstables (CASSANDRA-11337)
+ * sstablemetadata should print sstable min/max token (CASSANDRA-7159)
+ * Do not wrap CassandraException in TriggerExecutor (CASSANDRA-9421)
+ * COPY TO should have higher double precision (CASSANDRA-11255)
+ * Stress should exit with non-zero status after failure (CASSANDRA-10340)
+ * Add client to cqlsh SHOW_SESSION (CASSANDRA-8958)
+ * Fix nodetool tablestats keyspace level metrics (CASSANDRA-11226)
+ * Store repair options in parent_repair_history (CASSANDRA-11244)
+ * Print current leveling in sstableofflinerelevel (CASSANDRA-9588)
+ * Change repair message for keyspaces with RF 1 (CASSANDRA-11203)
+ * Remove hard-coded SSL cipher suites and protocols (CASSANDRA-10508)
+ * Improve concurrency in CompactionStrategyManager (CASSANDRA-10099)
+ * (cqlsh) interpret CQL type for formatting blobs (CASSANDRA-11274)
+ * Refuse to start and print txn log information in case of disk
+ corruption (CASSANDRA-10112)
+ * Resolve some eclipse-warnings (CASSANDRA-11086)
+ * (cqlsh) Show static columns in a different color (CASSANDRA-11059)
+ * Allow to remove TTLs on table with default_time_to_live (CASSANDRA-11207)
+Merged from 3.0:
+ * Properly respond with ProtocolError when a v1/v2 native protocol
+ header is received (CASSANDRA-11464)
* Validate that num_tokens and initial_token are consistent with one another (CASSANDRA-10120)
Merged from 2.2:
* IncomingStreamingConnection version check message wrong (CASSANDRA-11462)