cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject [1/6] git commit: Finer grained exception hierarchy, and adds error codes
Date Wed, 05 Sep 2012 15:51:59 GMT
Updated Branches:
  refs/heads/trunk 00e715054 -> 3a2faf942


Finer grained exception hierarchy, and adds error codes

patch by slebresne; reviewed by thepaul for CASSANDRA-3979


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

Branch: refs/heads/trunk
Commit: 3a2faf9424769cfee5fdad25f4513611820ca980
Parents: 00e7150
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Wed Aug 1 08:40:50 2012 +0200
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Wed Sep 5 17:50:59 2012 +0200

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 doc/native_protocol.spec                           |   80 ++-
 .../apache/cassandra/auth/SimpleAuthenticator.java |    2 +-
 .../org/apache/cassandra/auth/SimpleAuthority.java |    2 +-
 .../cassandra/auth/AllowAllAuthenticator.java      |    2 +-
 .../apache/cassandra/auth/AllowAllAuthority.java   |    2 +-
 .../org/apache/cassandra/auth/IAuthenticator.java  |    2 +-
 src/java/org/apache/cassandra/auth/IAuthority.java |    2 +-
 src/java/org/apache/cassandra/cli/CliClient.java   |    6 +-
 src/java/org/apache/cassandra/config/Avro.java     |    4 +-
 .../org/apache/cassandra/config/CFMetaData.java    |   71 +-
 .../apache/cassandra/config/ColumnDefinition.java  |    7 +-
 .../cassandra/config/ConfigurationException.java   |   31 -
 .../cassandra/config/DatabaseDescriptor.java       |    1 +
 .../org/apache/cassandra/config/KSMetaData.java    |    1 +
 .../apache/cassandra/cql/AbstractModification.java |    9 +-
 .../apache/cassandra/cql/AlterTableStatement.java  |    6 +-
 src/java/org/apache/cassandra/cql/Attributes.java  |    2 +-
 .../org/apache/cassandra/cql/BatchStatement.java   |    7 +-
 src/java/org/apache/cassandra/cql/CFPropDefs.java  |    9 +-
 src/java/org/apache/cassandra/cql/Cql.g            |   14 +-
 .../cassandra/cql/CreateColumnFamilyStatement.java |   19 +-
 .../cassandra/cql/CreateKeyspaceStatement.java     |    2 +-
 .../org/apache/cassandra/cql/DeleteStatement.java  |    9 +-
 .../apache/cassandra/cql/DropIndexStatement.java   |    3 +-
 .../org/apache/cassandra/cql/QueryProcessor.java   |   76 +--
 .../org/apache/cassandra/cql/SelectStatement.java  |    2 +-
 src/java/org/apache/cassandra/cql/Term.java        |    2 +-
 .../org/apache/cassandra/cql/UpdateStatement.java  |   14 +-
 src/java/org/apache/cassandra/cql3/Attributes.java |    2 +-
 .../org/apache/cassandra/cql3/CFDefinition.java    |    2 +-
 src/java/org/apache/cassandra/cql3/CFPropDefs.java |    2 +-
 .../org/apache/cassandra/cql3/CQLStatement.java    |   10 +-
 .../apache/cassandra/cql3/ColumnNameBuilder.java   |    2 +-
 src/java/org/apache/cassandra/cql3/Cql.g           |   21 +-
 src/java/org/apache/cassandra/cql3/ParsedType.java |    9 +-
 .../org/apache/cassandra/cql3/QueryProcessor.java  |   32 +-
 src/java/org/apache/cassandra/cql3/Term.java       |    4 +-
 .../cassandra/cql3/operations/ColumnOperation.java |    2 +-
 .../cassandra/cql3/operations/ListOperation.java   |    2 +-
 .../cassandra/cql3/operations/MapOperation.java    |    2 +-
 .../cassandra/cql3/operations/Operation.java       |    2 +-
 .../cassandra/cql3/operations/SetOperation.java    |    2 +-
 .../cql3/statements/AlterTableStatement.java       |    2 +-
 .../cassandra/cql3/statements/BatchStatement.java  |    9 +-
 .../cassandra/cql3/statements/CFStatement.java     |    2 +-
 .../statements/CreateColumnFamilyStatement.java    |  267 ++++----
 .../cql3/statements/CreateIndexStatement.java      |    4 +-
 .../cql3/statements/CreateKeyspaceStatement.java   |   25 +-
 .../cassandra/cql3/statements/DeleteStatement.java |    6 +-
 .../cql3/statements/DropColumnFamilyStatement.java |    2 +-
 .../cql3/statements/DropIndexStatement.java        |    2 +-
 .../cql3/statements/DropKeyspaceStatement.java     |    6 +-
 .../cql3/statements/ModificationStatement.java     |   30 +-
 .../cassandra/cql3/statements/ParsedStatement.java |    4 +-
 .../cql3/statements/SchemaAlteringStatement.java   |   15 +-
 .../cassandra/cql3/statements/SelectStatement.java |   48 +-
 .../cql3/statements/TruncateStatement.java         |   15 +-
 .../cassandra/cql3/statements/UpdateStatement.java |    9 +-
 .../cassandra/cql3/statements/UseStatement.java    |    2 +-
 .../org/apache/cassandra/db/ColumnFamilyStore.java |    1 +
 .../cassandra/db/ColumnFamilyStoreMBean.java       |    2 +-
 .../org/apache/cassandra/db/ConsistencyLevel.java  |  114 +++
 .../org/apache/cassandra/db/CounterColumn.java     |    9 +-
 .../org/apache/cassandra/db/CounterMutation.java   |    2 +-
 .../cassandra/db/CounterMutationVerbHandler.java   |   16 +-
 src/java/org/apache/cassandra/db/DefsTable.java    |    1 +
 .../apache/cassandra/db/HintedHandOffManager.java  |    5 +-
 .../cassandra/db/KeyspaceNotDefinedException.java  |    2 +-
 .../org/apache/cassandra/db/RangeSliceCommand.java |   10 +-
 src/java/org/apache/cassandra/db/SystemTable.java  |    2 +-
 src/java/org/apache/cassandra/db/Table.java        |    1 +
 .../apache/cassandra/db/index/SecondaryIndex.java  |    2 +-
 .../cassandra/db/index/SecondaryIndexManager.java  |    2 +-
 .../db/index/composites/CompositesIndex.java       |    2 +-
 .../apache/cassandra/db/index/keys/KeysIndex.java  |    2 +-
 .../apache/cassandra/db/marshal/AbstractType.java  |    4 +-
 .../db/marshal/ColumnToCollectionType.java         |    5 +-
 .../apache/cassandra/db/marshal/CompositeType.java |    7 +-
 .../cassandra/db/marshal/DynamicCompositeType.java |   17 +-
 .../org/apache/cassandra/db/marshal/ListType.java  |    5 +-
 .../org/apache/cassandra/db/marshal/MapType.java   |    5 +-
 .../apache/cassandra/db/marshal/ReversedType.java  |    5 +-
 .../org/apache/cassandra/db/marshal/SetType.java   |    5 +-
 .../apache/cassandra/db/marshal/TypeParser.java    |   44 +-
 .../dht/AbstractByteOrderedPartitioner.java        |    1 +
 .../org/apache/cassandra/dht/BootStrapper.java     |    3 +-
 .../apache/cassandra/dht/Murmur3Partitioner.java   |    2 +-
 .../cassandra/dht/OrderPreservingPartitioner.java  |    1 +
 .../apache/cassandra/dht/RandomPartitioner.java    |    2 +-
 src/java/org/apache/cassandra/dht/Token.java       |    2 +-
 .../exceptions/AlreadyExistsException.java         |   42 ++
 .../cassandra/exceptions/CassandraException.java   |   42 ++
 .../exceptions/ConfigurationException.java         |   36 +
 .../apache/cassandra/exceptions/ExceptionCode.java |   68 ++
 .../exceptions/InvalidRequestException.java        |   26 +
 .../exceptions/IsBootstrappingException.java       |   26 +
 .../cassandra/exceptions/OverloadedException.java  |   26 +
 .../cassandra/exceptions/ReadTimeoutException.java |   36 +
 .../exceptions/RequestExecutionException.java      |   33 +
 .../exceptions/RequestTimeoutException.java        |   40 ++
 .../exceptions/RequestValidationException.java     |   31 +
 .../cassandra/exceptions/SyntaxException.java      |   26 +
 .../cassandra/exceptions/TransportException.java   |   33 +
 .../cassandra/exceptions/TruncateException.java    |   31 +
 .../exceptions/UnauthorizedException.java          |   26 +
 .../cassandra/exceptions/UnavailableException.java |   40 ++
 .../exceptions/WriteTimeoutException.java          |   32 +
 .../cassandra/hadoop/ColumnFamilyRecordReader.java |    2 +-
 .../org/apache/cassandra/hadoop/ConfigHelper.java  |    2 +-
 .../cassandra/hadoop/pig/CassandraStorage.java     |   11 +-
 .../cassandra/io/compress/CompressionMetadata.java |    2 +-
 .../io/compress/CompressionParameters.java         |    2 +-
 .../apache/cassandra/io/sstable/SSTableLoader.java |    2 +-
 .../locator/AbstractReplicationStrategy.java       |    4 +-
 .../cassandra/locator/Ec2MultiRegionSnitch.java    |    2 +-
 .../org/apache/cassandra/locator/Ec2Snitch.java    |    2 +-
 .../locator/GossipingPropertyFileSnitch.java       |    2 +-
 .../apache/cassandra/locator/LocalStrategy.java    |    2 +-
 .../cassandra/locator/NetworkTopologyStrategy.java |    2 +-
 .../locator/OldNetworkTopologyStrategy.java        |    2 +-
 .../cassandra/locator/PropertyFileSnitch.java      |    2 +-
 .../apache/cassandra/locator/SimpleStrategy.java   |    2 +-
 .../org/apache/cassandra/net/MessagingService.java |    2 +-
 .../service/AbstractWriteResponseHandler.java      |   14 +-
 .../apache/cassandra/service/CassandraDaemon.java  |    2 +-
 .../org/apache/cassandra/service/ClientState.java  |   25 +-
 .../cassandra/service/DatacenterReadCallback.java  |   13 +-
 .../DatacenterSyncWriteResponseHandler.java        |   13 +-
 .../service/DatacenterWriteResponseHandler.java    |   14 +-
 .../cassandra/service/IWriteResponseHandler.java   |    6 +-
 .../apache/cassandra/service/MigrationManager.java |    7 +-
 .../apache/cassandra/service/MigrationTask.java    |    2 +-
 .../org/apache/cassandra/service/ReadCallback.java |   41 +-
 .../apache/cassandra/service/RepairCallback.java   |    2 +-
 .../org/apache/cassandra/service/StorageProxy.java |   80 ++-
 .../apache/cassandra/service/StorageService.java   |    7 +-
 .../cassandra/service/StorageServiceMBean.java     |    8 +-
 .../cassandra/service/WriteResponseHandler.java    |   30 +-
 .../apache/cassandra/thrift/CassandraServer.java   |  547 +++++++++------
 .../apache/cassandra/thrift/ThriftConversion.java  |   92 +++
 .../apache/cassandra/thrift/ThriftValidation.java  |  222 +++----
 src/java/org/apache/cassandra/tools/NodeCmd.java   |    6 +-
 src/java/org/apache/cassandra/tools/NodeProbe.java |    4 +-
 .../org/apache/cassandra/tools/SSTableExport.java  |    2 +-
 .../org/apache/cassandra/tools/SSTableImport.java  |    2 +-
 .../cassandra/tools/SSTableMetadataViewer.java     |    2 +-
 src/java/org/apache/cassandra/tracing/Tracing.java |    8 +-
 .../apache/cassandra/tracing/TracingAppender.java  |    6 +-
 .../org/apache/cassandra/transport/DataType.java   |    4 +-
 .../cassandra/transport/ProtocolException.java     |   14 +-
 .../apache/cassandra/transport/ServerError.java    |   44 ++
 .../apache/cassandra/transport/SimpleClient.java   |    2 +-
 .../cassandra/transport/messages/ErrorMessage.java |  158 ++++-
 .../transport/messages/ExecuteMessage.java         |    2 +-
 .../cassandra/transport/messages/QueryMessage.java |    8 +-
 .../transport/messages/StartupMessage.java         |    8 +-
 .../org/apache/cassandra/utils/FBUtilities.java    |    2 +-
 .../apache/cassandra/db/MeteredFlusherTest.java    |    2 +-
 test/unit/org/apache/cassandra/SchemaLoader.java   |    1 +
 test/unit/org/apache/cassandra/cli/CliTest.java    |    2 +-
 .../cassandra/config/DatabaseDescriptorTest.java   |    3 +-
 .../unit/org/apache/cassandra/config/DefsTest.java |    1 +
 test/unit/org/apache/cassandra/db/CleanupTest.java |    2 +-
 .../apache/cassandra/db/ColumnFamilyStoreTest.java |    2 +-
 test/unit/org/apache/cassandra/db/ScrubTest.java   |    2 +-
 .../cassandra/db/SecondaryIndexColumnSizeTest.java |    2 +-
 .../cassandra/db/marshal/CompositeTypeTest.java    |    5 +-
 .../cassandra/db/marshal/TypeParserTest.java       |    9 +-
 .../locator/DynamicEndpointSnitchTest.java         |    2 +-
 .../apache/cassandra/locator/EC2SnitchTest.java    |    2 +-
 .../locator/NetworkTopologyStrategyTest.java       |    2 +-
 .../ReplicationStrategyEndpointCacheTest.java      |    2 +-
 .../cassandra/locator/SimpleStrategyTest.java      |    2 +-
 .../service/AntiEntropyServiceCounterTest.java     |    2 +-
 .../service/EmbeddedCassandraServiceTest.java      |    2 +-
 .../apache/cassandra/service/InitClientTest.java   |    2 +-
 .../cassandra/service/LeaveAndBootstrapTest.java   |    2 +-
 .../org/apache/cassandra/service/MoveTest.java     |    2 +-
 .../org/apache/cassandra/service/RemoveTest.java   |    2 +-
 .../service/StorageServiceClientTest.java          |    2 +-
 .../service/StorageServiceServerTest.java          |    2 +-
 .../cassandra/thrift/ThriftValidationTest.java     |    7 +-
 .../src/org/apache/cassandra/stress/Session.java   |    5 +-
 184 files changed, 2187 insertions(+), 1127 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 291905f..8125e38 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -47,6 +47,7 @@
  * remove schema agreement checking from all external APIs (Thrift, CQL and CQL3) (CASSANDRA-4487)
  * add Murmur3Partitioner and make it default for new installations (CASSANDRA-3772)
  * (cql3) update pseudo-map syntax to use map syntax (CASSANDRA-4497)
+ * Finer grained exceptions hierarchy and provides error code with exceptions (CASSANDRA-3979)
 
 
 1.1.5

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/doc/native_protocol.spec
----------------------------------------------------------------------
diff --git a/doc/native_protocol.spec b/doc/native_protocol.spec
index 9c30db9..d19963b 100644
--- a/doc/native_protocol.spec
+++ b/doc/native_protocol.spec
@@ -255,8 +255,9 @@ Table of Contents
 4.2.1. ERROR
 
   Indicates an error processing a request. The body of the message will be an
-  error code ([int]) followed by a [string] error message. The error codes are
-  defined in Section 6.
+  error code ([int]) followed by a [string] error message. Then, depending on
+  the exception, more content may follow. The error codes are defined in
+  Section 6, along with their additional content if any.
 
 
 4.2.2. READY
@@ -404,11 +405,70 @@ Table of Contents
 
 6. Error codes
 
-  The currently supported errors are:
-    0x0000    Server error
-    0x0001    Protocol error
-    0x0002    Authentication error
-    0x0100    Unavailable exception
-    0x0101    Timeout exception
-    0x0102    Schema disagreement exception
-    0x0200    Request exception
+  The supported error codes are described below:
+    0x0000    Server error: something unexpected happened. This indicates a
+              server-side bug.
+    0x000A    Protocol error: some client message triggered a protocol
+              violation (for instance a QUERY message is sent before a STARTUP
+              one has been sent)
+
+    0x1000    Unavailable exception. The rest of the ERROR message body will be
+                <cl><required><alive>
+              where:
+                <cl> is a [string] representing the consistency level of the
+                     query having triggered the exception.
+                <required> is an [int] representing the number of node that
+                           should be alive to respect <cl>
+                <alive> is an [int] representing the number of replica that
+                        were known to be alive when the request has been
+                        processed (since an unavailable exception has been
+                        triggered, there will be <alive> < <required>)
+    0x1001    Overloaded: the request cannot be processed because the
+              coordinator node is overloaded
+    0x1002    Is_bootstrapping: the request was a read request but the
+              coordinator node is bootstrapping
+    0x1003    Truncate_error: error during a truncation error.
+    0x1100    Write_timeout: Timeout exception during a write request. The rest
+              of the ERROR message body will be
+                <cl><received><blockfor>
+              where:
+                <cl> is a [string] representing the consistency level of the
+                     query having triggered the exception.
+                <received> is an [int] representing the number of nodes having
+                           acknowledged the request.
+                <blockfor> is the number of replica whose acknowledgement is
+                           required to achieve <cl>.
+    0x1200    Read_timeout: Timeout exception during a read request. The rest
+              of the ERROR message body will be
+                <cl><received><blockfor><data_present>
+              where:
+                <cl> is a [string] representing the consistency level of the
+                     query having triggered the exception.
+                <received> is an [int] representing the number of nodes having
+                           answered the request.
+                <blockfor> is the number of replica whose response is
+                           required to achieve <cl>. Please note that it is
+                           possible to have <received> >= <blockfor> if
+                           <data_present> is false. And also in the (unlikely)
+                           case were <cl> is achieved but the coordinator node
+                           timeout while waiting for read-repair
+                           acknowledgement.
+                <data_present> is a single byte. If its value is 0, it means
+                               the replica that was asked for data has not
+                               responded. Otherwise, the value is != 0.
+
+    0x2000    Syntax_error: The submitted query has a syntax error.
+    0x2100    Unauthorized: The logged user doesn't have the right to perform
+              the query.
+    0x2200    Invalid: The query is syntactically correct but invalid.
+    0x2300    Config_error: The query is invalid because of some configuration issue
+    0x2400    Already_exists: The query attempted to create a keyspace or a
+              table that was already existing. The rest of the ERROR message
+              body will be <ks><table> where:
+                <ks> is a [string] representing either the keyspace that
+                     already exists, or the keyspace in which the table that
+                     already exists is.
+                <table> is a [string] representing the name of the table that
+                        already exists. If the query was attempting to create a
+                        keyspace, <table> will be present but will be the empty
+                        string.

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/examples/simple_authentication/src/org/apache/cassandra/auth/SimpleAuthenticator.java
----------------------------------------------------------------------
diff --git a/examples/simple_authentication/src/org/apache/cassandra/auth/SimpleAuthenticator.java b/examples/simple_authentication/src/org/apache/cassandra/auth/SimpleAuthenticator.java
index c8d63b7..357a465 100644
--- a/examples/simple_authentication/src/org/apache/cassandra/auth/SimpleAuthenticator.java
+++ b/examples/simple_authentication/src/org/apache/cassandra/auth/SimpleAuthenticator.java
@@ -29,7 +29,7 @@ import java.security.MessageDigest;
 import java.util.Map;
 import java.util.Properties;
 
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.io.util.FileUtils;
 import org.apache.cassandra.thrift.AuthenticationException;
 import org.apache.cassandra.utils.FBUtilities;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/examples/simple_authentication/src/org/apache/cassandra/auth/SimpleAuthority.java
----------------------------------------------------------------------
diff --git a/examples/simple_authentication/src/org/apache/cassandra/auth/SimpleAuthority.java b/examples/simple_authentication/src/org/apache/cassandra/auth/SimpleAuthority.java
index 6127370..88814ec 100644
--- a/examples/simple_authentication/src/org/apache/cassandra/auth/SimpleAuthority.java
+++ b/examples/simple_authentication/src/org/apache/cassandra/auth/SimpleAuthority.java
@@ -29,7 +29,7 @@ import java.util.EnumSet;
 import java.util.List;
 import java.util.Properties;
 
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.io.util.FileUtils;
 
 public class SimpleAuthority implements IAuthority

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/auth/AllowAllAuthenticator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/auth/AllowAllAuthenticator.java b/src/java/org/apache/cassandra/auth/AllowAllAuthenticator.java
index 238dac4..af88372 100644
--- a/src/java/org/apache/cassandra/auth/AllowAllAuthenticator.java
+++ b/src/java/org/apache/cassandra/auth/AllowAllAuthenticator.java
@@ -19,7 +19,7 @@ package org.apache.cassandra.auth;
 
 import java.util.Map;
 
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.thrift.AuthenticationException;
 
 public class AllowAllAuthenticator implements IAuthenticator

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/auth/AllowAllAuthority.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/auth/AllowAllAuthority.java b/src/java/org/apache/cassandra/auth/AllowAllAuthority.java
index afa6dd4..5a6f86d 100644
--- a/src/java/org/apache/cassandra/auth/AllowAllAuthority.java
+++ b/src/java/org/apache/cassandra/auth/AllowAllAuthority.java
@@ -20,7 +20,7 @@ package org.apache.cassandra.auth;
 import java.util.EnumSet;
 import java.util.List;
 
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 
 public class AllowAllAuthority implements IAuthority
 {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/auth/IAuthenticator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/auth/IAuthenticator.java b/src/java/org/apache/cassandra/auth/IAuthenticator.java
index 3d0d683..4f50383 100644
--- a/src/java/org/apache/cassandra/auth/IAuthenticator.java
+++ b/src/java/org/apache/cassandra/auth/IAuthenticator.java
@@ -19,7 +19,7 @@ package org.apache.cassandra.auth;
 
 import java.util.Map;
 
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.thrift.AuthenticationException;
 
 public interface IAuthenticator

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/auth/IAuthority.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/auth/IAuthority.java b/src/java/org/apache/cassandra/auth/IAuthority.java
index 2ece320..5bbdbe1 100644
--- a/src/java/org/apache/cassandra/auth/IAuthority.java
+++ b/src/java/org/apache/cassandra/auth/IAuthority.java
@@ -20,7 +20,7 @@ package org.apache.cassandra.auth;
 import java.util.EnumSet;
 import java.util.List;
 
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 
 /**
  * Cassandra's resource hierarchy looks something like:

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cli/CliClient.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cli/CliClient.java b/src/java/org/apache/cassandra/cli/CliClient.java
index bedcc59..090bef5 100644
--- a/src/java/org/apache/cassandra/cli/CliClient.java
+++ b/src/java/org/apache/cassandra/cli/CliClient.java
@@ -34,7 +34,7 @@ import org.apache.commons.lang.StringUtils;
 
 import org.antlr.runtime.tree.Tree;
 import org.apache.cassandra.auth.IAuthenticator;
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.RequestValidationException;
 import org.apache.cassandra.db.ColumnFamilyStoreMBean;
 import org.apache.cassandra.db.compaction.CompactionManagerMBean;
 import org.apache.cassandra.db.compaction.OperationType;
@@ -547,7 +547,7 @@ public class CliClient
             {
                 return TypeParser.parse(compareWith);
             }
-            catch (ConfigurationException ce)
+            catch (RequestValidationException ce)
             {
                 StringBuilder errorMessage = new StringBuilder("Unknown comparator '" + compareWith + "'. ");
                 errorMessage.append("Available functions: ");
@@ -1545,7 +1545,7 @@ public class CliClient
         {
             comparator = TypeParser.parse(defaultType);
         }
-        catch (ConfigurationException e)
+        catch (RequestValidationException e)
         {
             try
             {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/config/Avro.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/Avro.java b/src/java/org/apache/cassandra/config/Avro.java
index ed914f2..a7498d3 100644
--- a/src/java/org/apache/cassandra/config/Avro.java
+++ b/src/java/org/apache/cassandra/config/Avro.java
@@ -26,6 +26,8 @@ import org.apache.cassandra.db.marshal.AbstractType;
 import org.apache.cassandra.db.marshal.BytesType;
 import org.apache.cassandra.db.marshal.TypeParser;
 import org.apache.cassandra.db.migration.avro.CfDef;
+import org.apache.cassandra.exceptions.ConfigurationException;
+import org.apache.cassandra.exceptions.RequestValidationException;
 import org.apache.cassandra.io.compress.CompressionParameters;
 import org.apache.cassandra.locator.AbstractReplicationStrategy;
 import org.apache.cassandra.locator.NetworkTopologyStrategy;
@@ -211,7 +213,7 @@ public class Avro
             AbstractType<?> validatorType = TypeParser.parse(cd.validation_class);
             return new ColumnDefinition(ByteBufferUtil.clone(cd.name), validatorType, index_type, ColumnDefinition.getStringMap(cd.index_options), index_name, null);
         }
-        catch (ConfigurationException e)
+        catch (RequestValidationException e)
         {
             throw new RuntimeException(e);
         }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/config/CFMetaData.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/CFMetaData.java b/src/java/org/apache/cassandra/config/CFMetaData.java
index dbe0c6f..d410210 100644
--- a/src/java/org/apache/cassandra/config/CFMetaData.java
+++ b/src/java/org/apache/cassandra/config/CFMetaData.java
@@ -40,11 +40,14 @@ import org.apache.cassandra.db.*;
 import org.apache.cassandra.db.compaction.AbstractCompactionStrategy;
 import org.apache.cassandra.db.index.SecondaryIndex;
 import org.apache.cassandra.db.marshal.*;
+import org.apache.cassandra.exceptions.ConfigurationException;
+import org.apache.cassandra.exceptions.InvalidRequestException;
+import org.apache.cassandra.exceptions.RequestValidationException;
+import org.apache.cassandra.exceptions.SyntaxException;
 import org.apache.cassandra.io.IColumnSerializer;
 import org.apache.cassandra.io.compress.CompressionParameters;
 import org.apache.cassandra.io.compress.SnappyCompressor;
 import org.apache.cassandra.thrift.IndexType;
-import org.apache.cassandra.thrift.InvalidRequestException;
 import org.apache.cassandra.tracing.Tracing;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.FBUtilities;
@@ -287,11 +290,7 @@ public final class CFMetaData
             statement.applyPropertiesTo(cfmd);
             return cfmd;
         }
-        catch (InvalidRequestException e)
-        {
-            throw new RuntimeException(e);
-        }
-        catch (ConfigurationException e)
+        catch (RequestValidationException e)
         {
             throw new RuntimeException(e);
         }
@@ -658,34 +657,34 @@ public final class CFMetaData
 
         applyImplicitDefaults(cf_def);
 
-        CFMetaData newCFMD = new CFMetaData(cf_def.keyspace,
-                                            cf_def.name,
-                                            cfType,
-                                            TypeParser.parse(cf_def.comparator_type),
-                                            cf_def.subcomparator_type == null ? null : TypeParser.parse(cf_def.subcomparator_type));
-
-        if (cf_def.isSetGc_grace_seconds()) { newCFMD.gcGraceSeconds(cf_def.gc_grace_seconds); }
-        if (cf_def.isSetMin_compaction_threshold()) { newCFMD.minCompactionThreshold(cf_def.min_compaction_threshold); }
-        if (cf_def.isSetMax_compaction_threshold()) { newCFMD.maxCompactionThreshold(cf_def.max_compaction_threshold); }
-        if (cf_def.isSetKey_alias()) { newCFMD.keyAliases(Collections.<ByteBuffer>singletonList(cf_def.key_alias)); }
-        if (cf_def.isSetKey_validation_class()) { newCFMD.keyValidator(TypeParser.parse(cf_def.key_validation_class)); }
-        if (cf_def.isSetCompaction_strategy())
-            newCFMD.compactionStrategyClass = createCompactionStrategy(cf_def.compaction_strategy);
-        if (cf_def.isSetCompaction_strategy_options())
-            newCFMD.compactionStrategyOptions(new HashMap<String, String>(cf_def.compaction_strategy_options));
-        if (cf_def.isSetBloom_filter_fp_chance())
-            newCFMD.bloomFilterFpChance(cf_def.bloom_filter_fp_chance);
-        if (cf_def.isSetCaching())
-            newCFMD.caching(Caching.fromString(cf_def.caching));
-        if (cf_def.isSetRead_repair_chance())
-            newCFMD.readRepairChance(cf_def.read_repair_chance);
-        if (cf_def.isSetDclocal_read_repair_chance())
-            newCFMD.dcLocalReadRepairChance(cf_def.dclocal_read_repair_chance);
-
-        CompressionParameters cp = CompressionParameters.create(cf_def.compression_options);
-
         try
         {
+            CFMetaData newCFMD = new CFMetaData(cf_def.keyspace,
+                    cf_def.name,
+                    cfType,
+                    TypeParser.parse(cf_def.comparator_type),
+                    cf_def.subcomparator_type == null ? null : TypeParser.parse(cf_def.subcomparator_type));
+
+            if (cf_def.isSetGc_grace_seconds()) { newCFMD.gcGraceSeconds(cf_def.gc_grace_seconds); }
+            if (cf_def.isSetMin_compaction_threshold()) { newCFMD.minCompactionThreshold(cf_def.min_compaction_threshold); }
+            if (cf_def.isSetMax_compaction_threshold()) { newCFMD.maxCompactionThreshold(cf_def.max_compaction_threshold); }
+            if (cf_def.isSetKey_alias()) { newCFMD.keyAliases(Collections.<ByteBuffer>singletonList(cf_def.key_alias)); }
+            if (cf_def.isSetKey_validation_class()) { newCFMD.keyValidator(TypeParser.parse(cf_def.key_validation_class)); }
+            if (cf_def.isSetCompaction_strategy())
+                newCFMD.compactionStrategyClass = createCompactionStrategy(cf_def.compaction_strategy);
+            if (cf_def.isSetCompaction_strategy_options())
+                newCFMD.compactionStrategyOptions(new HashMap<String, String>(cf_def.compaction_strategy_options));
+            if (cf_def.isSetBloom_filter_fp_chance())
+                newCFMD.bloomFilterFpChance(cf_def.bloom_filter_fp_chance);
+            if (cf_def.isSetCaching())
+                newCFMD.caching(Caching.fromString(cf_def.caching));
+            if (cf_def.isSetRead_repair_chance())
+                newCFMD.readRepairChance(cf_def.read_repair_chance);
+            if (cf_def.isSetDclocal_read_repair_chance())
+                newCFMD.dcLocalReadRepairChance(cf_def.dclocal_read_repair_chance);
+
+            CompressionParameters cp = CompressionParameters.create(cf_def.compression_options);
+
             return newCFMD.comment(cf_def.comment)
                           .replicateOnWrite(cf_def.replicate_on_write)
                           .defaultValidator(TypeParser.parse(cf_def.default_validation_class))
@@ -693,6 +692,10 @@ public final class CFMetaData
                           .columnMetadata(ColumnDefinition.fromThrift(cf_def.column_metadata))
                           .compressionParameters(cp);
         }
+        catch (SyntaxException e)
+        {
+            throw new ConfigurationException(e.getMessage());
+        }
         catch (MarshalException e)
         {
             throw new ConfigurationException(e.getMessage());
@@ -1301,6 +1304,10 @@ public final class CFMetaData
 
             return cfm;
         }
+        catch (SyntaxException e)
+        {
+            throw new RuntimeException(e);
+        }
         catch (ConfigurationException e)
         {
             throw new RuntimeException(e);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/config/ColumnDefinition.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/ColumnDefinition.java b/src/java/org/apache/cassandra/config/ColumnDefinition.java
index 677ddb8..328d0ff 100644
--- a/src/java/org/apache/cassandra/config/ColumnDefinition.java
+++ b/src/java/org/apache/cassandra/config/ColumnDefinition.java
@@ -27,6 +27,7 @@ import org.apache.cassandra.cql3.UntypedResultSet;
 import org.apache.cassandra.db.*;
 import org.apache.cassandra.db.filter.QueryPath;
 import org.apache.cassandra.db.marshal.*;
+import org.apache.cassandra.exceptions.*;
 import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.thrift.ColumnDef;
 import org.apache.cassandra.thrift.IndexType;
@@ -115,7 +116,7 @@ public class ColumnDefinition
         return cd;
     }
 
-    public static ColumnDefinition fromThrift(ColumnDef thriftColumnDef) throws ConfigurationException
+    public static ColumnDefinition fromThrift(ColumnDef thriftColumnDef) throws SyntaxException, ConfigurationException
     {
         return new ColumnDefinition(ByteBufferUtil.clone(thriftColumnDef.name),
                                     TypeParser.parse(thriftColumnDef.validation_class),
@@ -125,7 +126,7 @@ public class ColumnDefinition
                                     null);
     }
 
-    public static Map<ByteBuffer, ColumnDefinition> fromThrift(List<ColumnDef> thriftDefs) throws ConfigurationException
+    public static Map<ByteBuffer, ColumnDefinition> fromThrift(List<ColumnDef> thriftDefs) throws SyntaxException, ConfigurationException
     {
         if (thriftDefs == null)
             return new HashMap<ByteBuffer,ColumnDefinition>();
@@ -231,7 +232,7 @@ public class ColumnDefinition
                                              index_name,
                                              componentIndex));
             }
-            catch (ConfigurationException e)
+            catch (RequestValidationException e)
             {
                 throw new RuntimeException(e);
             }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/config/ConfigurationException.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/ConfigurationException.java b/src/java/org/apache/cassandra/config/ConfigurationException.java
deleted file mode 100644
index c23a522..0000000
--- a/src/java/org/apache/cassandra/config/ConfigurationException.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cassandra.config;
-
-public class ConfigurationException extends Exception
-{
-    public ConfigurationException(String message)
-    {
-        super(message);
-    }
-
-    public ConfigurationException(String message, Exception e)
-    {
-        super(message, e);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
index 7533214..467a6c6 100644
--- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
+++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
@@ -40,6 +40,7 @@ import org.apache.cassandra.db.ColumnFamilyStore;
 import org.apache.cassandra.db.DefsTable;
 import org.apache.cassandra.db.SystemTable;
 import org.apache.cassandra.dht.IPartitioner;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.io.FSWriteError;
 import org.apache.cassandra.io.util.FileUtils;
 import org.apache.cassandra.locator.DynamicEndpointSnitch;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/config/KSMetaData.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/KSMetaData.java b/src/java/org/apache/cassandra/config/KSMetaData.java
index ac528f3..5b5ab77 100644
--- a/src/java/org/apache/cassandra/config/KSMetaData.java
+++ b/src/java/org/apache/cassandra/config/KSMetaData.java
@@ -27,6 +27,7 @@ import org.apache.cassandra.cql3.QueryProcessor;
 import org.apache.cassandra.cql3.UntypedResultSet;
 import org.apache.cassandra.db.*;
 import org.apache.cassandra.db.filter.QueryPath;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.locator.*;
 import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.thrift.CfDef;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql/AbstractModification.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/AbstractModification.java b/src/java/org/apache/cassandra/cql/AbstractModification.java
index 3d58602..781094f 100644
--- a/src/java/org/apache/cassandra/cql/AbstractModification.java
+++ b/src/java/org/apache/cassandra/cql/AbstractModification.java
@@ -22,8 +22,9 @@ import java.util.List;
 
 import org.apache.cassandra.db.IMutation;
 import org.apache.cassandra.service.ClientState;
-import org.apache.cassandra.thrift.ConsistencyLevel;
-import org.apache.cassandra.thrift.InvalidRequestException;
+import org.apache.cassandra.db.ConsistencyLevel;
+import org.apache.cassandra.exceptions.InvalidRequestException;
+import org.apache.cassandra.exceptions.UnauthorizedException;
 
 public abstract class AbstractModification
 {
@@ -102,7 +103,7 @@ public abstract class AbstractModification
      * @throws InvalidRequestException on the wrong request
      */
     public abstract List<IMutation> prepareRowMutations(String keyspace, ClientState clientState, List<ByteBuffer> variables)
-            throws org.apache.cassandra.thrift.InvalidRequestException;
+    throws InvalidRequestException, UnauthorizedException;
 
     /**
      * Convert statement into a list of mutations to apply on the server
@@ -116,5 +117,5 @@ public abstract class AbstractModification
      * @throws InvalidRequestException on the wrong request
      */
     public abstract List<IMutation> prepareRowMutations(String keyspace, ClientState clientState, Long timestamp, List<ByteBuffer> variables)
-            throws org.apache.cassandra.thrift.InvalidRequestException;
+    throws InvalidRequestException, UnauthorizedException;
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql/AlterTableStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/AlterTableStatement.java b/src/java/org/apache/cassandra/cql/AlterTableStatement.java
index 85d7619..5210f25 100644
--- a/src/java/org/apache/cassandra/cql/AlterTableStatement.java
+++ b/src/java/org/apache/cassandra/cql/AlterTableStatement.java
@@ -19,8 +19,8 @@ package org.apache.cassandra.cql;
 
 import org.apache.cassandra.config.*;
 import org.apache.cassandra.db.marshal.TypeParser;
+import org.apache.cassandra.exceptions.*;
 import org.apache.cassandra.io.compress.CompressionParameters;
-import org.apache.cassandra.thrift.InvalidRequestException;
 
 import java.nio.ByteBuffer;
 import java.util.HashMap;
@@ -63,7 +63,7 @@ public class AlterTableStatement
         }
     }
 
-    public CFMetaData getCFMetaData(String keyspace) throws ConfigurationException, InvalidRequestException
+    public CFMetaData getCFMetaData(String keyspace) throws ConfigurationException, InvalidRequestException, SyntaxException
     {
         CFMetaData meta = Schema.instance.getCFMetaData(keyspace, columnFamily);
         CFMetaData cfm = meta.clone();
@@ -171,7 +171,7 @@ public class AlterTableStatement
             {
                 cfm.defaultValidator(cfProps.getValidator());
             }
-            catch (ConfigurationException e)
+            catch (RequestValidationException e)
             {
                 throw new InvalidRequestException(String.format("Invalid validation type %s",
                                                                 cfProps.getProperty(CFPropDefs.KW_DEFAULTVALIDATION)));

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql/Attributes.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/Attributes.java b/src/java/org/apache/cassandra/cql/Attributes.java
index 07c08b1..faee3b8 100644
--- a/src/java/org/apache/cassandra/cql/Attributes.java
+++ b/src/java/org/apache/cassandra/cql/Attributes.java
@@ -17,7 +17,7 @@
  */
 package org.apache.cassandra.cql;
 
-import org.apache.cassandra.thrift.ConsistencyLevel;
+import org.apache.cassandra.db.ConsistencyLevel;
 
 /**
  * Class to contain attributes for statements

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql/BatchStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/BatchStatement.java b/src/java/org/apache/cassandra/cql/BatchStatement.java
index 6060aeb..95849e7 100644
--- a/src/java/org/apache/cassandra/cql/BatchStatement.java
+++ b/src/java/org/apache/cassandra/cql/BatchStatement.java
@@ -22,9 +22,10 @@ import java.util.LinkedList;
 import java.util.List;
 
 import org.apache.cassandra.db.IMutation;
+import org.apache.cassandra.db.ConsistencyLevel;
+import org.apache.cassandra.exceptions.InvalidRequestException;
+import org.apache.cassandra.exceptions.UnauthorizedException;
 import org.apache.cassandra.service.ClientState;
-import org.apache.cassandra.thrift.ConsistencyLevel;
-import org.apache.cassandra.thrift.InvalidRequestException;
 
 /**
  * A <code>BATCH</code> statement parsed from a CQL query.
@@ -75,7 +76,7 @@ public class BatchStatement
     }
 
     public List<IMutation> getMutations(String keyspace, ClientState clientState, List<ByteBuffer> variables)
-    throws InvalidRequestException
+    throws InvalidRequestException, UnauthorizedException
     {
         List<IMutation> batch = new LinkedList<IMutation>();
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql/CFPropDefs.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/CFPropDefs.java b/src/java/org/apache/cassandra/cql/CFPropDefs.java
index 5cd14be..8771c1b 100644
--- a/src/java/org/apache/cassandra/cql/CFPropDefs.java
+++ b/src/java/org/apache/cassandra/cql/CFPropDefs.java
@@ -19,13 +19,14 @@ package org.apache.cassandra.cql;
 
 import com.google.common.collect.Sets;
 import org.apache.cassandra.config.CFMetaData;
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.db.compaction.AbstractCompactionStrategy;
 import org.apache.cassandra.db.marshal.AbstractType;
 import org.apache.cassandra.db.marshal.TypeParser;
+import org.apache.cassandra.exceptions.InvalidRequestException;
+import org.apache.cassandra.exceptions.SyntaxException;
 import org.apache.cassandra.io.compress.CompressionParameters;
 import org.apache.cassandra.io.compress.SnappyCompressor;
-import org.apache.cassandra.thrift.InvalidRequestException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -204,14 +205,14 @@ public class CFPropDefs {
      * knows what they are doing (a custom comparator/validator for example), and pass it on as-is.
      */
 
-    public AbstractType<?> getComparator() throws ConfigurationException
+    public AbstractType<?> getComparator() throws ConfigurationException, SyntaxException
     {
         return TypeParser.parse((comparators.get(getPropertyString(KW_COMPARATOR, "text")) != null)
                                   ? comparators.get(getPropertyString(KW_COMPARATOR, "text"))
                                   : getPropertyString(KW_COMPARATOR, "text"));
     }
 
-    public AbstractType<?> getValidator() throws ConfigurationException
+    public AbstractType<?> getValidator() throws ConfigurationException, SyntaxException
     {
         return TypeParser.parse((comparators.get(getPropertyString(KW_DEFAULTVALIDATION, "text")) != null)
                                   ? comparators.get(getPropertyString(KW_DEFAULTVALIDATION, "text"))

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql/Cql.g
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/Cql.g b/src/java/org/apache/cassandra/cql/Cql.g
index 0b7e3b6..3c41f44 100644
--- a/src/java/org/apache/cassandra/cql/Cql.g
+++ b/src/java/org/apache/cassandra/cql/Cql.g
@@ -33,9 +33,9 @@ options {
     import java.util.Collections;
     import java.util.List;
     import java.util.ArrayList;
+    import org.apache.cassandra.exceptions.SyntaxException;
     import org.apache.cassandra.utils.Pair;
-    import org.apache.cassandra.thrift.ConsistencyLevel;
-    import org.apache.cassandra.thrift.InvalidRequestException;
+    import org.apache.cassandra.db.ConsistencyLevel;
 
     import static org.apache.cassandra.cql.AlterTableStatement.OperationType;
 }
@@ -56,10 +56,10 @@ options {
         return recognitionErrors;
     }
     
-    public void throwLastRecognitionError() throws InvalidRequestException
+    public void throwLastRecognitionError() throws SyntaxException
     {
         if (recognitionErrors.size() > 0)
-            throw new InvalidRequestException(recognitionErrors.get((recognitionErrors.size()-1)));
+            throw new SyntaxException(recognitionErrors.get((recognitionErrors.size()-1)));
     }
 
     // used by UPDATE of the counter columns to validate if '-' was supplied by user
@@ -72,7 +72,7 @@ options {
 
 @lexer::header {
     package org.apache.cassandra.cql;
-    import org.apache.cassandra.thrift.InvalidRequestException;
+    import org.apache.cassandra.exceptions.SyntaxException;
 }
 
 @lexer::members {
@@ -104,10 +104,10 @@ options {
         return recognitionErrors;
     }
     
-    public void throwLastRecognitionError() throws InvalidRequestException
+    public void throwLastRecognitionError() throws SyntaxException
     {
         if (recognitionErrors.size() > 0)
-            throw new InvalidRequestException(recognitionErrors.get((recognitionErrors.size()-1)));
+            throw new SyntaxException(recognitionErrors.get((recognitionErrors.size()-1)));
     }
 }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java b/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java
index 4c86b6e..e0b69a4 100644
--- a/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java
+++ b/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java
@@ -26,11 +26,12 @@ import java.util.Map;
 
 import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.config.ColumnDefinition;
-import org.apache.cassandra.config.ConfigurationException;
 import org.apache.cassandra.db.ColumnFamilyType;
 import org.apache.cassandra.db.marshal.AbstractType;
 import org.apache.cassandra.db.marshal.TypeParser;
-import org.apache.cassandra.thrift.InvalidRequestException;
+import org.apache.cassandra.exceptions.ConfigurationException;
+import org.apache.cassandra.exceptions.InvalidRequestException;
+import org.apache.cassandra.exceptions.SyntaxException;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.io.compress.CompressionParameters;
 
@@ -69,6 +70,10 @@ public class CreateColumnFamilyStatement
         {
             throw new InvalidRequestException(e.toString());
         }
+        catch (SyntaxException e)
+        {
+            throw new InvalidRequestException(e.toString());
+        }
 
         for (Map.Entry<Term, String> column : columns.entrySet())
         {
@@ -139,6 +144,12 @@ public class CreateColumnFamilyStatement
                 ex.initCause(e);
                 throw ex;
             }
+            catch (SyntaxException e)
+            {
+                InvalidRequestException ex = new InvalidRequestException(e.toString());
+                ex.initCause(e);
+                throw ex;
+            }
         }
 
         return columnDefs;
@@ -191,6 +202,10 @@ public class CreateColumnFamilyStatement
         {
             throw new InvalidRequestException(e.toString());
         }
+        catch (SyntaxException e)
+        {
+            throw new InvalidRequestException(e.toString());
+        }
         return newCFMD;
     }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql/CreateKeyspaceStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/CreateKeyspaceStatement.java b/src/java/org/apache/cassandra/cql/CreateKeyspaceStatement.java
index 98b9b6c..8c2aa1b 100644
--- a/src/java/org/apache/cassandra/cql/CreateKeyspaceStatement.java
+++ b/src/java/org/apache/cassandra/cql/CreateKeyspaceStatement.java
@@ -20,7 +20,7 @@ package org.apache.cassandra.cql;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.cassandra.thrift.InvalidRequestException;
+import org.apache.cassandra.exceptions.InvalidRequestException;
 
 /** A <code>CREATE KEYSPACE</code> statement parsed from a CQL query. */
 public class CreateKeyspaceStatement

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql/DeleteStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/DeleteStatement.java b/src/java/org/apache/cassandra/cql/DeleteStatement.java
index 0411419..e7d73e8 100644
--- a/src/java/org/apache/cassandra/cql/DeleteStatement.java
+++ b/src/java/org/apache/cassandra/cql/DeleteStatement.java
@@ -28,8 +28,9 @@ import org.apache.cassandra.db.IMutation;
 import org.apache.cassandra.db.RowMutation;
 import org.apache.cassandra.db.filter.QueryPath;
 import org.apache.cassandra.db.marshal.AbstractType;
+import org.apache.cassandra.exceptions.InvalidRequestException;
+import org.apache.cassandra.exceptions.UnauthorizedException;
 import org.apache.cassandra.service.ClientState;
-import org.apache.cassandra.thrift.InvalidRequestException;
 
 import static org.apache.cassandra.thrift.ThriftValidation.validateColumnFamily;
 import static org.apache.cassandra.cql.QueryProcessor.validateColumnName;
@@ -61,12 +62,14 @@ public class DeleteStatement extends AbstractModification
         return keys;
     }
 
-    public List<IMutation> prepareRowMutations(String keyspace, ClientState clientState, List<ByteBuffer> variables) throws InvalidRequestException
+    public List<IMutation> prepareRowMutations(String keyspace, ClientState clientState, List<ByteBuffer> variables)
+    throws InvalidRequestException, UnauthorizedException
     {
         return prepareRowMutations(keyspace, clientState, null, variables);
     }
 
-    public List<IMutation> prepareRowMutations(String keyspace, ClientState clientState, Long timestamp, List<ByteBuffer> variables) throws InvalidRequestException
+    public List<IMutation> prepareRowMutations(String keyspace, ClientState clientState, Long timestamp, List<ByteBuffer> variables)
+    throws InvalidRequestException, UnauthorizedException
     {
         CFMetaData metadata = validateColumnFamily(keyspace, columnFamily);
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql/DropIndexStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/DropIndexStatement.java b/src/java/org/apache/cassandra/cql/DropIndexStatement.java
index a8a8904..7df1f51 100644
--- a/src/java/org/apache/cassandra/cql/DropIndexStatement.java
+++ b/src/java/org/apache/cassandra/cql/DropIndexStatement.java
@@ -20,9 +20,10 @@ package org.apache.cassandra.cql;
 import java.io.IOException;
 
 import org.apache.cassandra.config.*;
+import org.apache.cassandra.exceptions.ConfigurationException;
+import org.apache.cassandra.exceptions.InvalidRequestException;
 import org.apache.cassandra.thrift.CfDef;
 import org.apache.cassandra.thrift.ColumnDef;
-import org.apache.cassandra.thrift.InvalidRequestException;
 
 public class DropIndexStatement
 {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql/QueryProcessor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/QueryProcessor.java b/src/java/org/apache/cassandra/cql/QueryProcessor.java
index 5cd2d1d..fcf4d5c 100644
--- a/src/java/org/apache/cassandra/cql/QueryProcessor.java
+++ b/src/java/org/apache/cassandra/cql/QueryProcessor.java
@@ -36,12 +36,24 @@ import org.apache.cassandra.db.marshal.AsciiType;
 import org.apache.cassandra.db.marshal.MarshalException;
 import org.apache.cassandra.db.marshal.TypeParser;
 import org.apache.cassandra.dht.*;
+import org.apache.cassandra.exceptions.*;
 import org.apache.cassandra.service.ClientState;
 import org.apache.cassandra.service.StorageProxy;
 import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.service.MigrationManager;
-import org.apache.cassandra.thrift.*;
 import org.apache.cassandra.thrift.Column;
+import org.apache.cassandra.db.ConsistencyLevel;
+import org.apache.cassandra.thrift.CqlMetadata;
+import org.apache.cassandra.thrift.CqlResult;
+import org.apache.cassandra.thrift.CqlResultType;
+import org.apache.cassandra.thrift.CqlRow;
+import org.apache.cassandra.thrift.CqlPreparedResult;
+import org.apache.cassandra.thrift.IndexExpression;
+import org.apache.cassandra.thrift.IndexOperator;
+import org.apache.cassandra.thrift.IndexType;
+import org.apache.cassandra.thrift.RequestType;
+import org.apache.cassandra.thrift.SchemaDisagreementException;
+import org.apache.cassandra.thrift.ThriftValidation;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.FBUtilities;
 import org.apache.cassandra.utils.Pair;
@@ -65,7 +77,7 @@ public class QueryProcessor
     public static final String DEFAULT_KEY_NAME = bufferToString(CFMetaData.DEFAULT_KEY_NAME);
 
     private static List<org.apache.cassandra.db.Row> getSlice(CFMetaData metadata, SelectStatement select, List<ByteBuffer> variables)
-    throws InvalidRequestException, TimedOutException, UnavailableException
+    throws InvalidRequestException, ReadTimeoutException, UnavailableException, IsBootstrappingException
     {
         QueryPath queryPath = new QueryPath(select.getColumnFamily());
         List<ReadCommand> commands = new ArrayList<ReadCommand>();
@@ -111,10 +123,6 @@ public class QueryProcessor
         {
             return StorageProxy.read(commands, select.getConsistencyLevel());
         }
-        catch (TimeoutException e)
-        {
-            throw new TimedOutException();
-        }
         catch (IOException e)
         {
             throw new RuntimeException(e);
@@ -137,7 +145,7 @@ public class QueryProcessor
     }
 
     private static List<org.apache.cassandra.db.Row> multiRangeSlice(CFMetaData metadata, SelectStatement select, List<ByteBuffer> variables)
-    throws TimedOutException, UnavailableException, InvalidRequestException
+    throws ReadTimeoutException, UnavailableException, InvalidRequestException
     {
         List<org.apache.cassandra.db.Row> rows;
         IPartitioner<?> p = StorageService.getPartitioner();
@@ -197,14 +205,6 @@ public class QueryProcessor
         {
             throw new RuntimeException(e);
         }
-        catch (org.apache.cassandra.thrift.UnavailableException e)
-        {
-            throw new UnavailableException();
-        }
-        catch (TimeoutException e)
-        {
-            throw new TimedOutException();
-        }
 
         // if start key was set and relation was "greater than"
         if (select.getKeyStart() != null && !select.includeStartKey() && !rows.isEmpty())
@@ -225,7 +225,7 @@ public class QueryProcessor
     }
 
     private static void batchUpdate(ClientState clientState, List<UpdateStatement> updateStatements, ConsistencyLevel consistency, List<ByteBuffer> variables )
-    throws InvalidRequestException, UnavailableException, TimedOutException
+    throws RequestValidationException, RequestExecutionException
     {
         String globalKeyspace = clientState.getKeyspace();
         List<IMutation> rowMutations = new ArrayList<IMutation>(updateStatements.size());
@@ -250,14 +250,7 @@ public class QueryProcessor
             validateKey(mutation.key());
         }
 
-        try
-        {
-            StorageProxy.mutate(rowMutations, consistency);
-        }
-        catch (org.apache.cassandra.thrift.UnavailableException e)
-        {
-            throw new UnavailableException();
-        }
+        StorageProxy.mutate(rowMutations, consistency);
     }
 
     private static IFilter filterFromSelect(SelectStatement select, CFMetaData metadata, List<ByteBuffer> variables)
@@ -279,7 +272,7 @@ public class QueryProcessor
     /* Test for SELECT-specific taboos */
     private static void validateSelect(String keyspace, SelectStatement select, List<ByteBuffer> variables) throws InvalidRequestException
     {
-        ThriftValidation.validateConsistencyLevel(keyspace, select.getConsistencyLevel(), RequestType.READ);
+        select.getConsistencyLevel().validateForRead(keyspace);
 
         // Finish key w/o start key (KEY < foo)
         if (!select.isKeyRange() && (select.getKeyFinish() != null))
@@ -405,7 +398,7 @@ public class QueryProcessor
     }
 
     public static CqlResult processStatement(CQLStatement statement,ClientState clientState, List<ByteBuffer> variables )
-    throws  UnavailableException, InvalidRequestException, TimedOutException
+    throws RequestExecutionException, RequestValidationException
     {
         String keyspace = null;
 
@@ -564,14 +557,14 @@ public class QueryProcessor
             case INSERT: // insert uses UpdateStatement
             case UPDATE:
                 UpdateStatement update = (UpdateStatement)statement.statement;
-                ThriftValidation.validateConsistencyLevel(keyspace, update.getConsistencyLevel(), RequestType.WRITE);
+                update.getConsistencyLevel().validateForWrite(keyspace);
                 batchUpdate(clientState, Collections.singletonList(update), update.getConsistencyLevel(), variables);
                 result.type = CqlResultType.VOID;
                 return result;
 
             case BATCH:
                 BatchStatement batch = (BatchStatement) statement.statement;
-                ThriftValidation.validateConsistencyLevel(keyspace, batch.getConsistencyLevel(), RequestType.WRITE);
+                batch.getConsistencyLevel().validateForWrite(keyspace);
 
                 if (batch.getTimeToLive() != 0)
                     throw new InvalidRequestException("Global TTL on the BATCH statement is not supported.");
@@ -593,14 +586,7 @@ public class QueryProcessor
                     validateKey(mutation.key());
                 }
 
-                try
-                {
-                    StorageProxy.mutate(mutations, batch.getConsistencyLevel());
-                }
-                catch (org.apache.cassandra.thrift.UnavailableException e)
-                {
-                    throw new UnavailableException();
-                }
+                StorageProxy.mutate(mutations, batch.getConsistencyLevel());
 
                 result.type = CqlResultType.VOID;
                 return result;
@@ -624,11 +610,11 @@ public class QueryProcessor
                 }
                 catch (TimeoutException e)
                 {
-                    throw (UnavailableException) new UnavailableException().initCause(e);
+                    throw new TruncateException(e);
                 }
                 catch (IOException e)
                 {
-                    throw (UnavailableException) new UnavailableException().initCause(e);
+                    throw new RuntimeException(e);
                 }
 
                 result.type = CqlResultType.VOID;
@@ -819,14 +805,14 @@ public class QueryProcessor
     }
 
     public static CqlResult process(String queryString, ClientState clientState)
-    throws UnavailableException, InvalidRequestException, TimedOutException
+    throws RequestValidationException, RequestExecutionException
     {
         logger.trace("CQL QUERY: {}", queryString);
         return processStatement(getStatement(queryString), clientState, new ArrayList<ByteBuffer>(0));
     }
 
     public static CqlPreparedResult prepare(String queryString, ClientState clientState)
-    throws InvalidRequestException
+    throws InvalidRequestException, SyntaxException
     {
         logger.trace("CQL QUERY: {}", queryString);
 
@@ -843,7 +829,7 @@ public class QueryProcessor
     }
 
     public static CqlResult processPrepared(CQLStatement statement, ClientState clientState, List<ByteBuffer> variables)
-    throws UnavailableException, InvalidRequestException, TimedOutException
+    throws RequestValidationException, RequestExecutionException
     {
         // Check to see if there are any bound variables to verify
         if (!(variables.isEmpty() && (statement.boundTerms == 0)))
@@ -891,7 +877,7 @@ public class QueryProcessor
         return keyString;
     }
 
-    private static CQLStatement getStatement(String queryStr) throws InvalidRequestException
+    private static CQLStatement getStatement(String queryStr) throws SyntaxException
     {
         try
         {
@@ -913,14 +899,12 @@ public class QueryProcessor
         }
         catch (RuntimeException re)
         {
-            InvalidRequestException ire = new InvalidRequestException("Failed parsing statement: [" + queryStr + "] reason: " + re.getClass().getSimpleName() + " " + re.getMessage());
-            ire.initCause(re);
+            SyntaxException ire = new SyntaxException("Failed parsing statement: [" + queryStr + "] reason: " + re.getClass().getSimpleName() + " " + re.getMessage());
             throw ire;
         }
         catch (RecognitionException e)
         {
-            InvalidRequestException ire = new InvalidRequestException("Invalid or malformed CQL query string");
-            ire.initCause(e);
+            SyntaxException ire = new SyntaxException("Invalid or malformed CQL query string: " + e.getMessage());
             throw ire;
         }
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql/SelectStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/SelectStatement.java b/src/java/org/apache/cassandra/cql/SelectStatement.java
index 426b63e..69b191d 100644
--- a/src/java/org/apache/cassandra/cql/SelectStatement.java
+++ b/src/java/org/apache/cassandra/cql/SelectStatement.java
@@ -24,7 +24,7 @@ import java.util.Set;
 import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.config.Schema;
 import org.apache.cassandra.db.marshal.AbstractType;
-import org.apache.cassandra.thrift.ConsistencyLevel;
+import org.apache.cassandra.db.ConsistencyLevel;
 
 /**
  * Encapsulates a completely parsed SELECT query, including the target

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql/Term.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/Term.java b/src/java/org/apache/cassandra/cql/Term.java
index fbd55fb..8cd312b 100644
--- a/src/java/org/apache/cassandra/cql/Term.java
+++ b/src/java/org/apache/cassandra/cql/Term.java
@@ -26,7 +26,7 @@ import org.apache.cassandra.db.marshal.FloatType;
 import org.apache.cassandra.db.marshal.IntegerType;
 import org.apache.cassandra.db.marshal.LexicalUUIDType;
 import org.apache.cassandra.db.marshal.MarshalException;
-import org.apache.cassandra.thrift.InvalidRequestException;
+import org.apache.cassandra.exceptions.InvalidRequestException;
 
 /** A term parsed from a CQL statement. */
 public class Term

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql/UpdateStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/UpdateStatement.java b/src/java/org/apache/cassandra/cql/UpdateStatement.java
index 54e5a1f..750cc09 100644
--- a/src/java/org/apache/cassandra/cql/UpdateStatement.java
+++ b/src/java/org/apache/cassandra/cql/UpdateStatement.java
@@ -24,19 +24,19 @@ import org.apache.cassandra.auth.Permission;
 import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.config.Schema;
 import org.apache.cassandra.db.CounterMutation;
+import org.apache.cassandra.db.ConsistencyLevel;
 import org.apache.cassandra.db.IMutation;
 import org.apache.cassandra.db.RowMutation;
 import org.apache.cassandra.db.filter.QueryPath;
 import org.apache.cassandra.db.marshal.AbstractType;
+import org.apache.cassandra.exceptions.InvalidRequestException;
+import org.apache.cassandra.exceptions.UnauthorizedException;
 import org.apache.cassandra.service.ClientState;
-import org.apache.cassandra.thrift.ConsistencyLevel;
-import org.apache.cassandra.thrift.InvalidRequestException;
 
 import static org.apache.cassandra.cql.QueryProcessor.validateColumn;
 import static org.apache.cassandra.cql.QueryProcessor.validateKey;
 
 import static org.apache.cassandra.thrift.ThriftValidation.validateColumnFamily;
-import static org.apache.cassandra.thrift.ThriftValidation.validateCommutativeForWrite;
 
 /**
  * An <code>UPDATE</code> statement parsed from a CQL query statement.
@@ -122,13 +122,15 @@ public class UpdateStatement extends AbstractModification
     }
 
     /** {@inheritDoc} */
-    public List<IMutation> prepareRowMutations(String keyspace, ClientState clientState, List<ByteBuffer> variables) throws InvalidRequestException
+    public List<IMutation> prepareRowMutations(String keyspace, ClientState clientState, List<ByteBuffer> variables)
+    throws InvalidRequestException, UnauthorizedException
     {
         return prepareRowMutations(keyspace, clientState, null, variables);
     }
 
     /** {@inheritDoc} */
-    public List<IMutation> prepareRowMutations(String keyspace, ClientState clientState, Long timestamp, List<ByteBuffer> variables) throws InvalidRequestException
+    public List<IMutation> prepareRowMutations(String keyspace, ClientState clientState, Long timestamp, List<ByteBuffer> variables)
+    throws InvalidRequestException, UnauthorizedException
     {
         List<String> cfamsSeen = new ArrayList<String>();
 
@@ -145,7 +147,7 @@ public class UpdateStatement extends AbstractModification
 
         CFMetaData metadata = validateColumnFamily(keyspace, columnFamily, hasCommutativeOperation);
         if (hasCommutativeOperation)
-            validateCommutativeForWrite(metadata, cLevel);
+            cLevel.validateCounterForWrite(metadata);
 
         QueryProcessor.validateKeyAlias(metadata, keyName);
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql3/Attributes.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/Attributes.java b/src/java/org/apache/cassandra/cql3/Attributes.java
index 5450249..00fd30b 100644
--- a/src/java/org/apache/cassandra/cql3/Attributes.java
+++ b/src/java/org/apache/cassandra/cql3/Attributes.java
@@ -17,7 +17,7 @@
  */
 package org.apache.cassandra.cql3;
 
-import org.apache.cassandra.thrift.ConsistencyLevel;
+import org.apache.cassandra.db.ConsistencyLevel;
 
 /**
  * Utility class for the Parser to gather attributes for modification

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql3/CFDefinition.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/CFDefinition.java b/src/java/org/apache/cassandra/cql3/CFDefinition.java
index 51f7ceb7..8e91ade 100644
--- a/src/java/org/apache/cassandra/cql3/CFDefinition.java
+++ b/src/java/org/apache/cassandra/cql3/CFDefinition.java
@@ -29,7 +29,7 @@ import org.apache.cassandra.db.marshal.AbstractType;
 import org.apache.cassandra.db.marshal.ColumnToCollectionType;
 import org.apache.cassandra.db.marshal.CompositeType;
 import org.apache.cassandra.db.marshal.UTF8Type;
-import org.apache.cassandra.thrift.InvalidRequestException;
+import org.apache.cassandra.exceptions.InvalidRequestException;
 import org.apache.cassandra.utils.ByteBufferUtil;
 
 /**

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql3/CFPropDefs.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/CFPropDefs.java b/src/java/org/apache/cassandra/cql3/CFPropDefs.java
index b7207fe..bd452a3 100644
--- a/src/java/org/apache/cassandra/cql3/CFPropDefs.java
+++ b/src/java/org/apache/cassandra/cql3/CFPropDefs.java
@@ -19,7 +19,7 @@ package org.apache.cassandra.cql3;
 
 import com.google.common.collect.Sets;
 import org.apache.cassandra.config.CFMetaData;
-import org.apache.cassandra.config.ConfigurationException;
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.db.compaction.AbstractCompactionStrategy;
 import org.apache.cassandra.io.compress.CompressionParameters;
 import org.slf4j.Logger;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql3/CQLStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/CQLStatement.java b/src/java/org/apache/cassandra/cql3/CQLStatement.java
index c1daa52..d0889bc 100644
--- a/src/java/org/apache/cassandra/cql3/CQLStatement.java
+++ b/src/java/org/apache/cassandra/cql3/CQLStatement.java
@@ -22,9 +22,7 @@ import java.util.List;
 
 import org.apache.cassandra.transport.messages.ResultMessage;
 import org.apache.cassandra.service.ClientState;
-import org.apache.cassandra.thrift.InvalidRequestException;
-import org.apache.cassandra.thrift.TimedOutException;
-import org.apache.cassandra.thrift.UnavailableException;
+import org.apache.cassandra.exceptions.*;
 
 public interface CQLStatement
 {
@@ -38,7 +36,7 @@ public interface CQLStatement
      *
      * @param state the current client state
      */
-    public void checkAccess(ClientState state) throws InvalidRequestException;
+    public void checkAccess(ClientState state) throws UnauthorizedException, InvalidRequestException;
 
     /**
      * Perform additional validation required by the statment.
@@ -46,7 +44,7 @@ public interface CQLStatement
      *
      * @param state the current client state
      */
-    public void validate(ClientState state) throws InvalidRequestException;
+    public void validate(ClientState state) throws RequestValidationException;
 
     /**
      * Execute the statement and return the resulting result or null if there is no result.
@@ -55,5 +53,5 @@ public interface CQLStatement
      * @param variables the values for bounded variables. The implementation
      * can assume that each bound term have a corresponding value.
      */
-    public ResultMessage execute(ClientState state, List<ByteBuffer> variables) throws InvalidRequestException, UnavailableException, TimedOutException;
+    public ResultMessage execute(ClientState state, List<ByteBuffer> variables) throws RequestValidationException, RequestExecutionException;
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql3/ColumnNameBuilder.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/ColumnNameBuilder.java b/src/java/org/apache/cassandra/cql3/ColumnNameBuilder.java
index 380153f..4c7f434 100644
--- a/src/java/org/apache/cassandra/cql3/ColumnNameBuilder.java
+++ b/src/java/org/apache/cassandra/cql3/ColumnNameBuilder.java
@@ -20,7 +20,7 @@ package org.apache.cassandra.cql3;
 import java.nio.ByteBuffer;
 import java.util.List;
 
-import org.apache.cassandra.thrift.InvalidRequestException;
+import org.apache.cassandra.exceptions.InvalidRequestException;
 
 /**
  * Build a potentially composite column name.

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql3/Cql.g
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/Cql.g b/src/java/org/apache/cassandra/cql3/Cql.g
index 8c43851..7c02da1 100644
--- a/src/java/org/apache/cassandra/cql3/Cql.g
+++ b/src/java/org/apache/cassandra/cql3/Cql.g
@@ -36,11 +36,12 @@ options {
 
     import org.apache.cassandra.cql3.operations.*;
     import org.apache.cassandra.cql3.statements.*;
-    import org.apache.cassandra.config.ConfigurationException;
     import org.apache.cassandra.db.marshal.CollectionType;
+    import org.apache.cassandra.exceptions.ConfigurationException;
+    import org.apache.cassandra.exceptions.InvalidRequestException;
+    import org.apache.cassandra.exceptions.SyntaxException;
     import org.apache.cassandra.utils.Pair;
-    import org.apache.cassandra.thrift.ConsistencyLevel;
-    import org.apache.cassandra.thrift.InvalidRequestException;
+    import org.apache.cassandra.db.ConsistencyLevel;
 }
 
 @members {
@@ -64,10 +65,10 @@ options {
         return recognitionErrors;
     }
 
-    public void throwLastRecognitionError() throws InvalidRequestException
+    public void throwLastRecognitionError() throws SyntaxException
     {
         if (recognitionErrors.size() > 0)
-            throw new InvalidRequestException(recognitionErrors.get((recognitionErrors.size()-1)));
+            throw new SyntaxException(recognitionErrors.get((recognitionErrors.size()-1)));
     }
 
     // used by UPDATE of the counter columns to validate if '-' was supplied by user
@@ -101,7 +102,7 @@ options {
 @lexer::header {
     package org.apache.cassandra.cql3;
 
-    import org.apache.cassandra.thrift.InvalidRequestException;
+    import org.apache.cassandra.exceptions.SyntaxException;
 }
 
 @lexer::members {
@@ -135,10 +136,10 @@ options {
         return recognitionErrors;
     }
 
-    public void throwLastRecognitionError() throws InvalidRequestException
+    public void throwLastRecognitionError() throws SyntaxException
     {
         if (recognitionErrors.size() > 0)
-            throw new InvalidRequestException(recognitionErrors.get((recognitionErrors.size()-1)));
+            throw new SyntaxException(recognitionErrors.get((recognitionErrors.size()-1)));
     }
 }
 
@@ -627,8 +628,10 @@ comparatorType returns [ParsedType t]
       {
         try {
             $t = new ParsedType.Custom($s.text);
-        } catch (ConfigurationException e) {
+        } catch (SyntaxException e) {
             addRecognitionError("Cannot parse type " + $s.text + ": " + e.getMessage());
+        } catch (ConfigurationException e) {
+            addRecognitionError("Errot setting type " + $s.text + ": " + e.getMessage());
         }
       }
     ;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql3/ParsedType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/ParsedType.java b/src/java/org/apache/cassandra/cql3/ParsedType.java
index 28e6be3..1bb8a12 100644
--- a/src/java/org/apache/cassandra/cql3/ParsedType.java
+++ b/src/java/org/apache/cassandra/cql3/ParsedType.java
@@ -17,9 +17,10 @@
  */
 package org.apache.cassandra.cql3;
 
-import org.apache.cassandra.config.ConfigurationException;
 import org.apache.cassandra.db.marshal.*;
-import org.apache.cassandra.thrift.InvalidRequestException;
+import org.apache.cassandra.exceptions.InvalidRequestException;
+import org.apache.cassandra.exceptions.ConfigurationException;
+import org.apache.cassandra.exceptions.SyntaxException;
 
 public interface ParsedType
 {
@@ -67,9 +68,9 @@ public interface ParsedType
     {
         private final AbstractType<?> type;
 
-        public Custom(String className) throws ConfigurationException
+        public Custom(String className) throws SyntaxException, ConfigurationException
         {
-            this.type =  TypeParser.parse(className);
+            this.type = TypeParser.parse(className);
         }
 
         public boolean isCollection()

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql3/QueryProcessor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/QueryProcessor.java b/src/java/org/apache/cassandra/cql3/QueryProcessor.java
index d5eb486..3fc8d99 100644
--- a/src/java/org/apache/cassandra/cql3/QueryProcessor.java
+++ b/src/java/org/apache/cassandra/cql3/QueryProcessor.java
@@ -30,8 +30,9 @@ import org.apache.cassandra.config.*;
 import org.apache.cassandra.db.*;
 import org.apache.cassandra.db.filter.*;
 import org.apache.cassandra.db.marshal.AbstractType;
+import org.apache.cassandra.exceptions.*;
 import org.apache.cassandra.service.ClientState;
-import org.apache.cassandra.thrift.*;
+import org.apache.cassandra.thrift.SchemaDisagreementException;
 import org.apache.cassandra.utils.FBUtilities;
 import org.apache.cassandra.utils.SemanticVersion;
 
@@ -100,7 +101,7 @@ public class QueryProcessor
     }
 
     private static ResultMessage processStatement(CQLStatement statement, ClientState clientState, List<ByteBuffer> variables)
-    throws  UnavailableException, InvalidRequestException, TimedOutException
+    throws RequestExecutionException, RequestValidationException
     {
         statement.checkAccess(clientState);
         statement.validate(clientState);
@@ -109,7 +110,7 @@ public class QueryProcessor
     }
 
     public static ResultMessage process(String queryString, ClientState clientState)
-    throws UnavailableException, InvalidRequestException, TimedOutException
+    throws RequestExecutionException, RequestValidationException
     {
         logger.trace("CQL QUERY: {}", queryString);
         return processStatement(getStatement(queryString, clientState).statement, clientState, Collections.<ByteBuffer>emptyList());
@@ -126,18 +127,14 @@ public class QueryProcessor
             else
                 return null;
         }
-        catch (UnavailableException e)
+        catch (RequestExecutionException e)
         {
             throw new RuntimeException(e);
         }
-        catch (InvalidRequestException e)
+        catch (RequestValidationException e)
         {
             throw new AssertionError(e);
         }
-        catch (TimedOutException e)
-        {
-            throw new RuntimeException(e);
-        }
     }
 
     public static UntypedResultSet resultify(String query, Row row)
@@ -148,14 +145,14 @@ public class QueryProcessor
             ResultSet cqlRows = ss.process(Collections.singletonList(row));
             return new UntypedResultSet(cqlRows);
         }
-        catch (InvalidRequestException e)
+        catch (RequestValidationException e)
         {
             throw new AssertionError(e);
         }
     }
 
     public static ResultMessage.Prepared prepare(String queryString, ClientState clientState)
-    throws InvalidRequestException
+    throws RequestValidationException
     {
         logger.trace("CQL QUERY: {}", queryString);
 
@@ -171,7 +168,7 @@ public class QueryProcessor
     }
 
     public static ResultMessage processPrepared(CQLStatement statement, ClientState clientState, List<ByteBuffer> variables)
-    throws UnavailableException, InvalidRequestException, TimedOutException
+    throws RequestExecutionException, RequestValidationException
     {
         // Check to see if there are any bound variables to verify
         if (!(variables.isEmpty() && (statement.getBoundsTerms() == 0)))
@@ -197,7 +194,8 @@ public class QueryProcessor
         return cql.hashCode();
     }
 
-    private static ParsedStatement.Prepared getStatement(String queryStr, ClientState clientState) throws InvalidRequestException
+    private static ParsedStatement.Prepared getStatement(String queryStr, ClientState clientState)
+    throws RequestValidationException
     {
         ParsedStatement statement = parseStatement(queryStr);
 
@@ -208,7 +206,7 @@ public class QueryProcessor
         return statement.prepare();
     }
 
-    public static ParsedStatement parseStatement(String queryStr) throws InvalidRequestException
+    public static ParsedStatement parseStatement(String queryStr) throws SyntaxException
     {
         try
         {
@@ -230,14 +228,12 @@ public class QueryProcessor
         }
         catch (RuntimeException re)
         {
-            InvalidRequestException ire = new InvalidRequestException("Failed parsing statement: [" + queryStr + "] reason: " + re.getClass().getSimpleName() + " " + re.getMessage());
-            ire.initCause(re);
+            SyntaxException ire = new SyntaxException("Failed parsing statement: [" + queryStr + "] reason: " + re.getClass().getSimpleName() + " " + re.getMessage());
             throw ire;
         }
         catch (RecognitionException e)
         {
-            InvalidRequestException ire = new InvalidRequestException("Invalid or malformed CQL query string");
-            ire.initCause(e);
+            SyntaxException ire = new SyntaxException("Invalid or malformed CQL query string: " + e.getMessage());
             throw ire;
         }
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql3/Term.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/Term.java b/src/java/org/apache/cassandra/cql3/Term.java
index 9be6499..3f46c35 100644
--- a/src/java/org/apache/cassandra/cql3/Term.java
+++ b/src/java/org/apache/cassandra/cql3/Term.java
@@ -21,12 +21,12 @@ import java.nio.ByteBuffer;
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.cassandra.config.ConfigurationException;
 import org.apache.cassandra.dht.IPartitioner;
 import org.apache.cassandra.dht.Token;
 import org.apache.cassandra.db.marshal.AbstractType;
 import org.apache.cassandra.db.marshal.MarshalException;
-import org.apache.cassandra.thrift.InvalidRequestException;
+import org.apache.cassandra.exceptions.ConfigurationException;
+import org.apache.cassandra.exceptions.InvalidRequestException;
 
 /** A term parsed from a CQL statement. */
 public class Term

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql3/operations/ColumnOperation.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/operations/ColumnOperation.java b/src/java/org/apache/cassandra/cql3/operations/ColumnOperation.java
index 4f36775..e7086c1 100644
--- a/src/java/org/apache/cassandra/cql3/operations/ColumnOperation.java
+++ b/src/java/org/apache/cassandra/cql3/operations/ColumnOperation.java
@@ -28,7 +28,7 @@ import org.apache.cassandra.db.filter.QueryPath;
 import org.apache.cassandra.db.marshal.AbstractType;
 import org.apache.cassandra.db.marshal.CollectionType;
 import org.apache.cassandra.db.marshal.LongType;
-import org.apache.cassandra.thrift.InvalidRequestException;
+import org.apache.cassandra.exceptions.InvalidRequestException;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.Pair;
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql3/operations/ListOperation.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/operations/ListOperation.java b/src/java/org/apache/cassandra/cql3/operations/ListOperation.java
index b4ba021..3de984b 100644
--- a/src/java/org/apache/cassandra/cql3/operations/ListOperation.java
+++ b/src/java/org/apache/cassandra/cql3/operations/ListOperation.java
@@ -31,7 +31,7 @@ import org.apache.cassandra.db.ColumnFamily;
 import org.apache.cassandra.db.IColumn;
 import org.apache.cassandra.db.marshal.AbstractType;
 import org.apache.cassandra.db.marshal.CollectionType;
-import org.apache.cassandra.thrift.InvalidRequestException;
+import org.apache.cassandra.exceptions.InvalidRequestException;
 import org.apache.cassandra.utils.Pair;
 import org.apache.cassandra.utils.UUIDGen;
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql3/operations/MapOperation.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/operations/MapOperation.java b/src/java/org/apache/cassandra/cql3/operations/MapOperation.java
index d843fc7..56b1038 100644
--- a/src/java/org/apache/cassandra/cql3/operations/MapOperation.java
+++ b/src/java/org/apache/cassandra/cql3/operations/MapOperation.java
@@ -30,7 +30,7 @@ import org.apache.cassandra.db.ColumnFamily;
 import org.apache.cassandra.db.IColumn;
 import org.apache.cassandra.db.marshal.AbstractType;
 import org.apache.cassandra.db.marshal.CollectionType;
-import org.apache.cassandra.thrift.InvalidRequestException;
+import org.apache.cassandra.exceptions.InvalidRequestException;
 import org.apache.cassandra.utils.Pair;
 
 public class MapOperation implements Operation

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql3/operations/Operation.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/operations/Operation.java b/src/java/org/apache/cassandra/cql3/operations/Operation.java
index 13c341c..5261677 100644
--- a/src/java/org/apache/cassandra/cql3/operations/Operation.java
+++ b/src/java/org/apache/cassandra/cql3/operations/Operation.java
@@ -27,7 +27,7 @@ import org.apache.cassandra.db.ColumnFamily;
 import org.apache.cassandra.db.IColumn;
 import org.apache.cassandra.db.marshal.AbstractType;
 import org.apache.cassandra.db.marshal.CollectionType;
-import org.apache.cassandra.thrift.InvalidRequestException;
+import org.apache.cassandra.exceptions.InvalidRequestException;
 import org.apache.cassandra.utils.Pair;
 
 public interface Operation

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a2faf94/src/java/org/apache/cassandra/cql3/operations/SetOperation.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/operations/SetOperation.java b/src/java/org/apache/cassandra/cql3/operations/SetOperation.java
index 22b4517..a31059c 100644
--- a/src/java/org/apache/cassandra/cql3/operations/SetOperation.java
+++ b/src/java/org/apache/cassandra/cql3/operations/SetOperation.java
@@ -27,7 +27,7 @@ import org.apache.cassandra.db.ColumnFamily;
 import org.apache.cassandra.db.IColumn;
 import org.apache.cassandra.db.marshal.AbstractType;
 import org.apache.cassandra.db.marshal.CollectionType;
-import org.apache.cassandra.thrift.InvalidRequestException;
+import org.apache.cassandra.exceptions.InvalidRequestException;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.Pair;
 


Mime
View raw message