Author: gdusbabek
Date: Wed Sep 1 16:20:12 2010
New Revision: 991589
URL: http://svn.apache.org/viewvc?rev=991589&view=rev
Log:
avro impls for system_drop_keyspace and system_rename_keyspace
Modified:
cassandra/trunk/interface/cassandra.genavro
cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java
Modified: cassandra/trunk/interface/cassandra.genavro
URL:
http://svn.apache.org/viewvc/cassandra/trunk/interface/cassandra.genavro?rev=991589&r1=991588&r2=991589&view=diff
==============================================================================
--- cassandra/trunk/interface/cassandra.genavro (original)
+++ cassandra/trunk/interface/cassandra.genavro Wed Sep 1 16:20:12 2010
@@ -252,6 +252,12 @@ protocol Cassandra {
string system_drop_column_family(string column_family)
throws InvalidRequestException;
+
+ string system_drop_keyspace(string keyspace)
+ throws InvalidRequestException;
+
+ string system_rename_keyspace(string old_name, string new_name)
+ throws InvalidRequestException;
array<string> describe_keyspaces();
Modified:
cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java
URL:
http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java?rev=991589&r1=991588&r2=991589&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java
(original)
+++ cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java Wed
Sep 1 16:20:12 2010
@@ -41,6 +41,8 @@ import org.apache.avro.generic.GenericDa
import org.apache.avro.ipc.AvroRemoteException;
import org.apache.avro.util.Utf8;
import org.apache.cassandra.avro.InvalidRequestException;
+import org.apache.cassandra.db.migration.DropKeyspace;
+import org.apache.cassandra.db.migration.RenameKeyspace;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -919,6 +921,56 @@ public class CassandraServer implements
}
@Override
+ public CharSequence system_drop_keyspace(CharSequence keyspace) throws
AvroRemoteException, InvalidRequestException
+ {
+ if (!(DatabaseDescriptor.getAuthenticator() instanceof
AllowAllAuthenticator))
+ throw newInvalidRequestException("Unable to create new keyspace
while authentication is enabled.");
+
+ try
+ {
+ applyMigrationOnStage(new DropKeyspace(keyspace.toString(), true));
+ return DatabaseDescriptor.getDefsVersion().toString();
+ }
+ catch (ConfigurationException e)
+ {
+ InvalidRequestException ex =
newInvalidRequestException(e.getMessage());
+ ex.initCause(e);
+ throw ex;
+ }
+ catch (IOException e)
+ {
+ InvalidRequestException ex =
newInvalidRequestException(e.getMessage());
+ ex.initCause(e);
+ throw ex;
+ }
+ }
+
+
+ @Override
+ public CharSequence system_rename_keyspace(CharSequence old_name,
CharSequence new_name) throws AvroRemoteException, InvalidRequestException
+ {
+ checkKeyspaceAndLoginAuthorized(Permission.WRITE);
+
+ try
+ {
+ applyMigrationOnStage(new RenameKeyspace(old_name.toString(),
new_name.toString()));
+ return DatabaseDescriptor.getDefsVersion().toString();
+ }
+ catch (ConfigurationException e)
+ {
+ InvalidRequestException ex =
newInvalidRequestException(e.getMessage());
+ ex.initCause(e);
+ throw ex;
+ }
+ catch (IOException e)
+ {
+ InvalidRequestException ex =
newInvalidRequestException(e.getMessage());
+ ex.initCause(e);
+ throw ex;
+ }
+ }
+
+ @Override
public CharSequence describe_partitioner() throws AvroRemoteException
{
return StorageService.getPartitioner().getClass().getName();