cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tylerho...@apache.org
Subject cassandra git commit: Log warning on unrecognized table during message deser
Date Thu, 07 May 2015 15:30:58 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.0 6ab0c301e -> 58de86bff


Log warning on unrecognized table during message deser

Patch by Tyler Hobbs; reviewed by Sylvain Lebresne for CASSANDRA-9136


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/58de86bf
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/58de86bf
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/58de86bf

Branch: refs/heads/cassandra-2.0
Commit: 58de86bff5e9383b679d9bb48cc95ec444275ca7
Parents: 6ab0c30
Author: Tyler Hobbs <tylerhobbs@apache.org>
Authored: Thu May 7 10:30:01 2015 -0500
Committer: Tyler Hobbs <tylerhobbs@apache.org>
Committed: Thu May 7 10:30:01 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt                                               |  2 ++
 src/java/org/apache/cassandra/db/PagedRangeCommand.java   | 10 ++++++++++
 src/java/org/apache/cassandra/db/RangeSliceCommand.java   |  7 +++++++
 .../org/apache/cassandra/db/SliceByNamesReadCommand.java  |  8 ++++++++
 .../org/apache/cassandra/db/SliceFromReadCommand.java     |  8 ++++++++
 5 files changed, 35 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/58de86bf/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index d76606c..8473777 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,6 @@
 2.0.15:
+ * Log warning message when a table is queried before the schema has fully
+   propagated (CASSANDRA-9136)
  * Overload SecondaryIndex#indexes to accept the column definition (CASSANDRA-9314)
  * (cqlsh) Add SERIAL and LOCAL_SERIAL consistency levels (CASSANDRA-8051)
  * Fix index selection during rebuild with certain table layouts (CASSANDRA-9281)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/58de86bf/src/java/org/apache/cassandra/db/PagedRangeCommand.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/PagedRangeCommand.java b/src/java/org/apache/cassandra/db/PagedRangeCommand.java
index a8d7f49..3bc6539 100644
--- a/src/java/org/apache/cassandra/db/PagedRangeCommand.java
+++ b/src/java/org/apache/cassandra/db/PagedRangeCommand.java
@@ -24,6 +24,7 @@ import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.cassandra.config.Schema;
 import org.apache.cassandra.db.filter.*;
 import org.apache.cassandra.dht.AbstractBounds;
 import org.apache.cassandra.io.IVersionedSerializer;
@@ -153,6 +154,15 @@ public class PagedRangeCommand extends AbstractRangeCommand
         {
             String keyspace = in.readUTF();
             String columnFamily = in.readUTF();
+
+            if (Schema.instance.getCFMetaData(keyspace, columnFamily) == null)
+            {
+                String message = String.format("Got paged range command for nonexistent table
%s.%s.  If the table was just " +
+                        "created, this is likely due to the schema not being fully propagated.
 Please wait for schema " +
+                        "agreement on table creation." , keyspace, columnFamily);
+                throw new UnknownColumnFamilyException(message, null);
+            }
+
             long timestamp = in.readLong();
 
             AbstractBounds<RowPosition> keyRange = AbstractBounds.serializer.deserialize(in,
version).toRowBounds();

http://git-wip-us.apache.org/repos/asf/cassandra/blob/58de86bf/src/java/org/apache/cassandra/db/RangeSliceCommand.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/RangeSliceCommand.java b/src/java/org/apache/cassandra/db/RangeSliceCommand.java
index 4aa1595..553f111 100644
--- a/src/java/org/apache/cassandra/db/RangeSliceCommand.java
+++ b/src/java/org/apache/cassandra/db/RangeSliceCommand.java
@@ -213,6 +213,13 @@ class RangeSliceCommandSerializer implements IVersionedSerializer<RangeSliceComm
         long timestamp = version < MessagingService.VERSION_20 ? System.currentTimeMillis()
: in.readLong();
 
         CFMetaData metadata = Schema.instance.getCFMetaData(keyspace, columnFamily);
+        if (metadata == null)
+        {
+            String message = String.format("Got range slice command for nonexistent table
%s.%s.  If the table was just " +
+                    "created, this is likely due to the schema not being fully propagated.
 Please wait for schema " +
+                    "agreement on table creation." , keyspace, columnFamily);
+            throw new UnknownColumnFamilyException(message, null);
+        }
 
         IDiskAtomFilter predicate;
         if (version < MessagingService.VERSION_20)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/58de86bf/src/java/org/apache/cassandra/db/SliceByNamesReadCommand.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/SliceByNamesReadCommand.java b/src/java/org/apache/cassandra/db/SliceByNamesReadCommand.java
index ae3db78..ec7c439 100644
--- a/src/java/org/apache/cassandra/db/SliceByNamesReadCommand.java
+++ b/src/java/org/apache/cassandra/db/SliceByNamesReadCommand.java
@@ -120,6 +120,14 @@ class SliceByNamesReadCommandSerializer implements IVersionedSerializer<ReadComm
         long timestamp = version < MessagingService.VERSION_20 ? System.currentTimeMillis()
: in.readLong();
 
         CFMetaData metadata = Schema.instance.getCFMetaData(keyspaceName, cfName);
+        if (metadata == null)
+        {
+            String message = String.format("Got slice command for nonexistent table %s.%s.
 If the table was just " +
+                    "created, this is likely due to the schema not being fully propagated.
 Please wait for schema " +
+                    "agreement on table creation." , keyspaceName, cfName);
+            throw new UnknownColumnFamilyException(message, null);
+        }
+
         ReadCommand command;
         if (version < MessagingService.VERSION_20)
         {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/58de86bf/src/java/org/apache/cassandra/db/SliceFromReadCommand.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/SliceFromReadCommand.java b/src/java/org/apache/cassandra/db/SliceFromReadCommand.java
index 7526796..afca338 100644
--- a/src/java/org/apache/cassandra/db/SliceFromReadCommand.java
+++ b/src/java/org/apache/cassandra/db/SliceFromReadCommand.java
@@ -181,6 +181,14 @@ class SliceFromReadCommandSerializer implements IVersionedSerializer<ReadCommand
         long timestamp = version < MessagingService.VERSION_20 ? System.currentTimeMillis()
: in.readLong();
 
         CFMetaData metadata = Schema.instance.getCFMetaData(keyspaceName, cfName);
+        if (metadata == null)
+        {
+            String message = String.format("Got slice command for nonexistent table %s.%s.
 If the table was just " +
+                    "created, this is likely due to the schema not being fully propagated.
 Please wait for schema " +
+                    "agreement on table creation." , keyspaceName, cfName);
+            throw new UnknownColumnFamilyException(message, null);
+        }
+
         SliceQueryFilter filter;
         if (version < MessagingService.VERSION_20)
         {


Mime
View raw message