You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ee...@apache.org on 2011/03/15 23:52:24 UTC
svn commit: r1081972 - in /cassandra/trunk/src/java/org/apache/cassandra:
cql/QueryProcessor.java thrift/CassandraServer.java
Author: eevans
Date: Tue Mar 15 22:52:24 2011
New Revision: 1081972
URL: http://svn.apache.org/viewvc?rev=1081972&view=rev
Log:
throw SchemaDisagreementException from DDL methods
Patch by eevans; reviewed by brandon.williams for CASSANDRA-2334
Modified:
cassandra/trunk/src/java/org/apache/cassandra/cql/QueryProcessor.java
cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java
Modified: cassandra/trunk/src/java/org/apache/cassandra/cql/QueryProcessor.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cql/QueryProcessor.java?rev=1081972&r1=1081971&r2=1081972&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cql/QueryProcessor.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cql/QueryProcessor.java Tue Mar 15 22:52:24 2011
@@ -425,17 +425,17 @@ public class QueryProcessor
}
// Copypasta from CassandraServer (where it is private).
- private static void validateSchemaAgreement() throws InvalidRequestException
+ private static void validateSchemaAgreement() throws SchemaDisagreementException
{
// unreachable hosts don't count towards disagreement
Map<String, List<String>> versions = Maps.filterKeys(StorageProxy.describeSchemaVersions(),
Predicates.not(Predicates.equalTo(StorageProxy.UNREACHABLE)));
if (versions.size() > 1)
- throw new InvalidRequestException("Cluster schema does not yet agree");
+ throw new SchemaDisagreementException();
}
public static CqlResult process(String queryString, ClientState clientState)
- throws RecognitionException, UnavailableException, InvalidRequestException, TimedOutException
+ throws RecognitionException, UnavailableException, InvalidRequestException, TimedOutException, SchemaDisagreementException
{
logger.trace("CQL QUERY: {}", queryString);
Modified: cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java?rev=1081972&r1=1081971&r2=1081972&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java Tue Mar 15 22:52:24 2011
@@ -703,7 +703,8 @@ public class CassandraServer implements
}
}
- public synchronized String system_add_column_family(CfDef cf_def) throws InvalidRequestException, TException
+ public synchronized String system_add_column_family(CfDef cf_def)
+ throws InvalidRequestException, SchemaDisagreementException, TException
{
logger.debug("add_column_family");
state().hasColumnFamilyListAccess(Permission.WRITE);
@@ -729,7 +730,8 @@ public class CassandraServer implements
}
}
- public synchronized String system_drop_column_family(String column_family) throws InvalidRequestException, TException
+ public synchronized String system_drop_column_family(String column_family)
+ throws InvalidRequestException, SchemaDisagreementException, TException
{
logger.debug("drop_column_family");
state().hasColumnFamilyListAccess(Permission.WRITE);
@@ -754,7 +756,8 @@ public class CassandraServer implements
}
}
- public synchronized String system_add_keyspace(KsDef ks_def) throws InvalidRequestException, TException
+ public synchronized String system_add_keyspace(KsDef ks_def)
+ throws InvalidRequestException, SchemaDisagreementException, TException
{
logger.debug("add_keyspace");
state().hasKeyspaceListAccess(Permission.WRITE);
@@ -800,7 +803,8 @@ public class CassandraServer implements
}
}
- public synchronized String system_drop_keyspace(String keyspace) throws InvalidRequestException, TException
+ public synchronized String system_drop_keyspace(String keyspace)
+ throws InvalidRequestException, SchemaDisagreementException, TException
{
logger.debug("drop_keyspace");
state().hasKeyspaceListAccess(Permission.WRITE);
@@ -825,8 +829,10 @@ public class CassandraServer implements
}
}
- /** update an existing keyspace, but do not allow column family modifications. */
- public synchronized String system_update_keyspace(KsDef ks_def) throws InvalidRequestException, TException
+ /** update an existing keyspace, but do not allow column family modifications.
+ * @throws SchemaDisagreementException */
+ public synchronized String system_update_keyspace(KsDef ks_def)
+ throws InvalidRequestException, SchemaDisagreementException, TException
{
logger.debug("update_keyspace");
state().hasKeyspaceListAccess(Permission.WRITE);
@@ -859,7 +865,8 @@ public class CassandraServer implements
}
}
- public synchronized String system_update_column_family(CfDef cf_def) throws InvalidRequestException, TException
+ public synchronized String system_update_column_family(CfDef cf_def)
+ throws InvalidRequestException, SchemaDisagreementException, TException
{
logger.debug("update_column_family");
state().hasColumnFamilyListAccess(Permission.WRITE);
@@ -893,13 +900,13 @@ public class CassandraServer implements
}
}
- private void validateSchemaAgreement() throws InvalidRequestException
+ private void validateSchemaAgreement() throws SchemaDisagreementException
{
// unreachable hosts don't count towards disagreement
Map<String, List<String>> versions = Maps.filterKeys(StorageProxy.describeSchemaVersions(),
Predicates.not(Predicates.equalTo(StorageProxy.UNREACHABLE)));
if (versions.size() > 1)
- throw new InvalidRequestException("Cluster schema does not yet agree");
+ throw new SchemaDisagreementException();
}
// @see CFMetaData.applyImplicitDefaults().
@@ -1150,7 +1157,7 @@ public class CassandraServer implements
}
public CqlResult execute_cql_query(ByteBuffer query, Compression compression)
- throws InvalidRequestException, UnavailableException, TimedOutException, TException
+ throws InvalidRequestException, UnavailableException, TimedOutException, SchemaDisagreementException, TException
{
String queryString = null;