cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r995086 - in /cassandra/trunk: ./ interface/ interface/thrift/gen-java/org/apache/cassandra/thrift/ src/java/org/apache/cassandra/avro/ src/java/org/apache/cassandra/hadoop/ src/java/org/apache/cassandra/thrift/
Date Wed, 08 Sep 2010 15:14:54 GMT
Author: jbellis
Date: Wed Sep  8 15:14:53 2010
New Revision: 995086

URL: http://svn.apache.org/viewvc?rev=995086&view=rev
Log:
remove keyspace from describe_splits method.  patch by Jeremy Hanna; reviewed by jbellis for
CASSANDRA-1425

Modified:
    cassandra/trunk/CHANGES.txt
    cassandra/trunk/interface/cassandra.genavro
    cassandra/trunk/interface/cassandra.thrift
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
    cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java
    cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilyInputFormat.java
    cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java

Modified: cassandra/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/trunk/CHANGES.txt?rev=995086&r1=995085&r2=995086&view=diff
==============================================================================
--- cassandra/trunk/CHANGES.txt (original)
+++ cassandra/trunk/CHANGES.txt Wed Sep  8 15:14:53 2010
@@ -61,6 +61,7 @@ dev
  * make failure to remove comitlog segment non-fatal (CASSANDRA-1348)
  * correct ordering of drain operations so CL.recover is no longer 
    necessary (CASSANDRA-1408)
+ * removed keyspace from describe_splits method (CASSANDRA-1425)
 
 
 0.7-beta1

Modified: cassandra/trunk/interface/cassandra.genavro
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/cassandra.genavro?rev=995086&r1=995085&r2=995086&view=diff
==============================================================================
--- cassandra/trunk/interface/cassandra.genavro (original)
+++ cassandra/trunk/interface/cassandra.genavro Wed Sep  8 15:14:53 2010
@@ -361,8 +361,7 @@ protocol Cassandra {
      * returns list of token strings such that first subrange is (list[0], list[1]],
      * next is (list[1], list[2]], etc.
      */
-    array<string> describe_splits(string keyspace,
-                                  string cfName,
+    array<string> describe_splits(string cfName,
                                   string start_token,
                                   string end_token,
                                   int keys_per_split);

Modified: cassandra/trunk/interface/cassandra.thrift
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/cassandra.thrift?rev=995086&r1=995085&r2=995086&view=diff
==============================================================================
--- cassandra/trunk/interface/cassandra.thrift (original)
+++ cassandra/trunk/interface/cassandra.thrift Wed Sep  8 15:14:53 2010
@@ -46,7 +46,7 @@ namespace rb CassandraThrift
 #           for every edit that doesn't result in a change to major/minor.
 #
 # See the Semantic Versioning Specification (SemVer) http://semver.org.
-const string VERSION = "13.0.0"
+const string VERSION = "14.0.0"
 
 
 #
@@ -523,11 +523,10 @@ service Cassandra {
 
       returns list of token strings such that first subrange is (list[0], list[1]],
       next is (list[1], list[2]], etc. */
-  list<string> describe_splits(1:required string keyspace,
-                               2:required string cfName,
-                               3:required string start_token, 
-                               4:required string end_token,
-                               5:required i32 keys_per_split),
+  list<string> describe_splits(1:required string cfName,
+                               2:required string start_token, 
+                               3:required string end_token,
+                               4:required i32 keys_per_split),
 
   /** adds a column family. returns the new schema id. */
   string system_add_column_family(1:required CfDef cf_def)

Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java?rev=995086&r1=995085&r2=995086&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java Wed
Sep  8 15:14:53 2010
@@ -226,13 +226,12 @@ public class Cassandra {
      * returns list of token strings such that first subrange is (list[0], list[1]],
      * next is (list[1], list[2]], etc.
      * 
-     * @param keyspace
      * @param cfName
      * @param start_token
      * @param end_token
      * @param keys_per_split
      */
-    public List<String> describe_splits(String keyspace, String cfName, String start_token,
String end_token, int keys_per_split) throws TException;
+    public List<String> describe_splits(String cfName, String start_token, String end_token,
int keys_per_split) throws TException;
 
     /**
      * adds a column family. returns the new schema id.
@@ -336,7 +335,7 @@ public class Cassandra {
 
     public void describe_keyspace(String keyspace, AsyncMethodCallback<AsyncClient.describe_keyspace_call>
resultHandler) throws TException;
 
-    public void describe_splits(String keyspace, String cfName, String start_token, String
end_token, int keys_per_split, AsyncMethodCallback<AsyncClient.describe_splits_call>
resultHandler) throws TException;
+    public void describe_splits(String cfName, String start_token, String end_token, int
keys_per_split, AsyncMethodCallback<AsyncClient.describe_splits_call> resultHandler)
throws TException;
 
     public void system_add_column_family(CfDef cf_def, AsyncMethodCallback<AsyncClient.system_add_column_family_call>
resultHandler) throws TException;
 
@@ -1234,17 +1233,16 @@ public class Cassandra {
       throw new TApplicationException(TApplicationException.MISSING_RESULT, "describe_keyspace
failed: unknown result");
     }
 
-    public List<String> describe_splits(String keyspace, String cfName, String start_token,
String end_token, int keys_per_split) throws TException
+    public List<String> describe_splits(String cfName, String start_token, String end_token,
int keys_per_split) throws TException
     {
-      send_describe_splits(keyspace, cfName, start_token, end_token, keys_per_split);
+      send_describe_splits(cfName, start_token, end_token, keys_per_split);
       return recv_describe_splits();
     }
 
-    public void send_describe_splits(String keyspace, String cfName, String start_token,
String end_token, int keys_per_split) throws TException
+    public void send_describe_splits(String cfName, String start_token, String end_token,
int keys_per_split) throws TException
     {
       oprot_.writeMessageBegin(new TMessage("describe_splits", TMessageType.CALL, ++seqid_));
       describe_splits_args args = new describe_splits_args();
-      args.setKeyspace(keyspace);
       args.setCfName(cfName);
       args.setStart_token(start_token);
       args.setEnd_token(end_token);
@@ -2292,21 +2290,19 @@ public class Cassandra {
       }
     }
 
-    public void describe_splits(String keyspace, String cfName, String start_token, String
end_token, int keys_per_split, AsyncMethodCallback<describe_splits_call> resultHandler)
throws TException {
+    public void describe_splits(String cfName, String start_token, String end_token, int
keys_per_split, AsyncMethodCallback<describe_splits_call> resultHandler) throws TException
{
       checkReady();
-      describe_splits_call method_call = new describe_splits_call(keyspace, cfName, start_token,
end_token, keys_per_split, resultHandler, this, protocolFactory, transport);
+      describe_splits_call method_call = new describe_splits_call(cfName, start_token, end_token,
keys_per_split, resultHandler, this, protocolFactory, transport);
       manager.call(method_call);
     }
 
     public static class describe_splits_call extends TAsyncMethodCall {
-      private String keyspace;
       private String cfName;
       private String start_token;
       private String end_token;
       private int keys_per_split;
-      public describe_splits_call(String keyspace, String cfName, String start_token, String
end_token, int keys_per_split, AsyncMethodCallback<describe_splits_call> resultHandler,
TAsyncClient client, TProtocolFactory protocolFactory, TNonblockingTransport transport) throws
TException {
+      public describe_splits_call(String cfName, String start_token, String end_token, int
keys_per_split, AsyncMethodCallback<describe_splits_call> resultHandler, TAsyncClient
client, TProtocolFactory protocolFactory, TNonblockingTransport transport) throws TException
{
         super(client, protocolFactory, transport, resultHandler, false);
-        this.keyspace = keyspace;
         this.cfName = cfName;
         this.start_token = start_token;
         this.end_token = end_token;
@@ -2316,7 +2312,6 @@ public class Cassandra {
       public void write_args(TProtocol prot) throws TException {
         prot.writeMessageBegin(new TMessage("describe_splits", TMessageType.CALL, 0));
         describe_splits_args args = new describe_splits_args();
-        args.setKeyspace(keyspace);
         args.setCfName(cfName);
         args.setStart_token(start_token);
         args.setEnd_token(end_token);
@@ -3428,7 +3423,7 @@ public class Cassandra {
         }
         iprot.readMessageEnd();
         describe_splits_result result = new describe_splits_result();
-        result.success = iface_.describe_splits(args.keyspace, args.cfName, args.start_token,
args.end_token, args.keys_per_split);
+        result.success = iface_.describe_splits(args.cfName, args.start_token, args.end_token,
args.keys_per_split);
         oprot.writeMessageBegin(new TMessage("describe_splits", TMessageType.REPLY, seqid));
         result.write(oprot);
         oprot.writeMessageEnd();
@@ -20750,13 +20745,11 @@ public class Cassandra {
   public static class describe_splits_args implements TBase<describe_splits_args, describe_splits_args._Fields>,
java.io.Serializable, Cloneable   {
     private static final TStruct STRUCT_DESC = new TStruct("describe_splits_args");
 
-    private static final TField KEYSPACE_FIELD_DESC = new TField("keyspace", TType.STRING,
(short)1);
-    private static final TField CF_NAME_FIELD_DESC = new TField("cfName", TType.STRING, (short)2);
-    private static final TField START_TOKEN_FIELD_DESC = new TField("start_token", TType.STRING,
(short)3);
-    private static final TField END_TOKEN_FIELD_DESC = new TField("end_token", TType.STRING,
(short)4);
-    private static final TField KEYS_PER_SPLIT_FIELD_DESC = new TField("keys_per_split",
TType.I32, (short)5);
+    private static final TField CF_NAME_FIELD_DESC = new TField("cfName", TType.STRING, (short)1);
+    private static final TField START_TOKEN_FIELD_DESC = new TField("start_token", TType.STRING,
(short)2);
+    private static final TField END_TOKEN_FIELD_DESC = new TField("end_token", TType.STRING,
(short)3);
+    private static final TField KEYS_PER_SPLIT_FIELD_DESC = new TField("keys_per_split",
TType.I32, (short)4);
 
-    public String keyspace;
     public String cfName;
     public String start_token;
     public String end_token;
@@ -20764,11 +20757,10 @@ public class Cassandra {
 
     /** The set of fields this struct contains, along with convenience methods for finding
and manipulating them. */
     public enum _Fields implements TFieldIdEnum {
-      KEYSPACE((short)1, "keyspace"),
-      CF_NAME((short)2, "cfName"),
-      START_TOKEN((short)3, "start_token"),
-      END_TOKEN((short)4, "end_token"),
-      KEYS_PER_SPLIT((short)5, "keys_per_split");
+      CF_NAME((short)1, "cfName"),
+      START_TOKEN((short)2, "start_token"),
+      END_TOKEN((short)3, "end_token"),
+      KEYS_PER_SPLIT((short)4, "keys_per_split");
 
       private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
@@ -20783,15 +20775,13 @@ public class Cassandra {
        */
       public static _Fields findByThriftId(int fieldId) {
         switch(fieldId) {
-          case 1: // KEYSPACE
-            return KEYSPACE;
-          case 2: // CF_NAME
+          case 1: // CF_NAME
             return CF_NAME;
-          case 3: // START_TOKEN
+          case 2: // START_TOKEN
             return START_TOKEN;
-          case 4: // END_TOKEN
+          case 3: // END_TOKEN
             return END_TOKEN;
-          case 5: // KEYS_PER_SPLIT
+          case 4: // KEYS_PER_SPLIT
             return KEYS_PER_SPLIT;
           default:
             return null;
@@ -20839,8 +20829,6 @@ public class Cassandra {
     public static final Map<_Fields, FieldMetaData> metaDataMap;
     static {
       Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
-      tmpMap.put(_Fields.KEYSPACE, new FieldMetaData("keyspace", TFieldRequirementType.REQUIRED,

-          new FieldValueMetaData(TType.STRING)));
       tmpMap.put(_Fields.CF_NAME, new FieldMetaData("cfName", TFieldRequirementType.REQUIRED,

           new FieldValueMetaData(TType.STRING)));
       tmpMap.put(_Fields.START_TOKEN, new FieldMetaData("start_token", TFieldRequirementType.REQUIRED,

@@ -20857,14 +20845,12 @@ public class Cassandra {
     }
 
     public describe_splits_args(
-      String keyspace,
       String cfName,
       String start_token,
       String end_token,
       int keys_per_split)
     {
       this();
-      this.keyspace = keyspace;
       this.cfName = cfName;
       this.start_token = start_token;
       this.end_token = end_token;
@@ -20878,9 +20864,6 @@ public class Cassandra {
     public describe_splits_args(describe_splits_args other) {
       __isset_bit_vector.clear();
       __isset_bit_vector.or(other.__isset_bit_vector);
-      if (other.isSetKeyspace()) {
-        this.keyspace = other.keyspace;
-      }
       if (other.isSetCfName()) {
         this.cfName = other.cfName;
       }
@@ -20902,30 +20885,6 @@ public class Cassandra {
       return new describe_splits_args(this);
     }
 
-    public String getKeyspace() {
-      return this.keyspace;
-    }
-
-    public describe_splits_args setKeyspace(String keyspace) {
-      this.keyspace = keyspace;
-      return this;
-    }
-
-    public void unsetKeyspace() {
-      this.keyspace = null;
-    }
-
-    /** Returns true if field keyspace is set (has been asigned a value) and false otherwise
*/
-    public boolean isSetKeyspace() {
-      return this.keyspace != null;
-    }
-
-    public void setKeyspaceIsSet(boolean value) {
-      if (!value) {
-        this.keyspace = null;
-      }
-    }
-
     public String getCfName() {
       return this.cfName;
     }
@@ -21023,14 +20982,6 @@ public class Cassandra {
 
     public void setFieldValue(_Fields field, Object value) {
       switch (field) {
-      case KEYSPACE:
-        if (value == null) {
-          unsetKeyspace();
-        } else {
-          setKeyspace((String)value);
-        }
-        break;
-
       case CF_NAME:
         if (value == null) {
           unsetCfName();
@@ -21072,9 +21023,6 @@ public class Cassandra {
 
     public Object getFieldValue(_Fields field) {
       switch (field) {
-      case KEYSPACE:
-        return getKeyspace();
-
       case CF_NAME:
         return getCfName();
 
@@ -21098,8 +21046,6 @@ public class Cassandra {
     /** Returns true if field corresponding to fieldID is set (has been asigned a value)
and false otherwise */
     public boolean isSet(_Fields field) {
       switch (field) {
-      case KEYSPACE:
-        return isSetKeyspace();
       case CF_NAME:
         return isSetCfName();
       case START_TOKEN:
@@ -21129,15 +21075,6 @@ public class Cassandra {
       if (that == null)
         return false;
 
-      boolean this_present_keyspace = true && this.isSetKeyspace();
-      boolean that_present_keyspace = true && that.isSetKeyspace();
-      if (this_present_keyspace || that_present_keyspace) {
-        if (!(this_present_keyspace && that_present_keyspace))
-          return false;
-        if (!this.keyspace.equals(that.keyspace))
-          return false;
-      }
-
       boolean this_present_cfName = true && this.isSetCfName();
       boolean that_present_cfName = true && that.isSetCfName();
       if (this_present_cfName || that_present_cfName) {
@@ -21190,15 +21127,6 @@ public class Cassandra {
       int lastComparison = 0;
       describe_splits_args typedOther = (describe_splits_args)other;
 
-      lastComparison = Boolean.valueOf(isSetKeyspace()).compareTo(typedOther.isSetKeyspace());
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-      if (isSetKeyspace()) {        lastComparison = TBaseHelper.compareTo(this.keyspace,
typedOther.keyspace);
-        if (lastComparison != 0) {
-          return lastComparison;
-        }
-      }
       lastComparison = Boolean.valueOf(isSetCfName()).compareTo(typedOther.isSetCfName());
       if (lastComparison != 0) {
         return lastComparison;
@@ -21248,35 +21176,28 @@ public class Cassandra {
           break;
         }
         switch (field.id) {
-          case 1: // KEYSPACE
-            if (field.type == TType.STRING) {
-              this.keyspace = iprot.readString();
-            } else { 
-              TProtocolUtil.skip(iprot, field.type);
-            }
-            break;
-          case 2: // CF_NAME
+          case 1: // CF_NAME
             if (field.type == TType.STRING) {
               this.cfName = iprot.readString();
             } else { 
               TProtocolUtil.skip(iprot, field.type);
             }
             break;
-          case 3: // START_TOKEN
+          case 2: // START_TOKEN
             if (field.type == TType.STRING) {
               this.start_token = iprot.readString();
             } else { 
               TProtocolUtil.skip(iprot, field.type);
             }
             break;
-          case 4: // END_TOKEN
+          case 3: // END_TOKEN
             if (field.type == TType.STRING) {
               this.end_token = iprot.readString();
             } else { 
               TProtocolUtil.skip(iprot, field.type);
             }
             break;
-          case 5: // KEYS_PER_SPLIT
+          case 4: // KEYS_PER_SPLIT
             if (field.type == TType.I32) {
               this.keys_per_split = iprot.readI32();
               setKeys_per_splitIsSet(true);
@@ -21302,11 +21223,6 @@ public class Cassandra {
       validate();
 
       oprot.writeStructBegin(STRUCT_DESC);
-      if (this.keyspace != null) {
-        oprot.writeFieldBegin(KEYSPACE_FIELD_DESC);
-        oprot.writeString(this.keyspace);
-        oprot.writeFieldEnd();
-      }
       if (this.cfName != null) {
         oprot.writeFieldBegin(CF_NAME_FIELD_DESC);
         oprot.writeString(this.cfName);
@@ -21334,14 +21250,6 @@ public class Cassandra {
       StringBuilder sb = new StringBuilder("describe_splits_args(");
       boolean first = true;
 
-      sb.append("keyspace:");
-      if (this.keyspace == null) {
-        sb.append("null");
-      } else {
-        sb.append(this.keyspace);
-      }
-      first = false;
-      if (!first) sb.append(", ");
       sb.append("cfName:");
       if (this.cfName == null) {
         sb.append("null");
@@ -21375,9 +21283,6 @@ public class Cassandra {
 
     public void validate() throws TException {
       // check for required fields
-      if (keyspace == null) {
-        throw new TProtocolException("Required field 'keyspace' was not present! Struct:
" + toString());
-      }
       if (cfName == null) {
         throw new TProtocolException("Required field 'cfName' was not present! Struct: "
+ toString());
       }

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=995086&r1=995085&r2=995086&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  8 15:14:53
2010
@@ -981,9 +981,9 @@ public class CassandraServer implements 
         return StorageService.getPartitioner().getClass().getName();
     }
 
-    public List<CharSequence> describe_splits(CharSequence keyspace, CharSequence cfName,
CharSequence start_token, CharSequence end_token, int keys_per_split) {
+    public List<CharSequence> describe_splits(CharSequence cfName, CharSequence start_token,
CharSequence end_token, int keys_per_split) {
         Token.TokenFactory<?> tf = StorageService.getPartitioner().getTokenFactory();
-        List<Token> tokens = StorageService.instance.getSplits(keyspace.toString(),
cfName.toString(), new Range(tf.fromString(start_token.toString()), tf.fromString(end_token.toString())),
keys_per_split);
+        List<Token> tokens = StorageService.instance.getSplits(clientState.getKeyspace(),
cfName.toString(), new Range(tf.fromString(start_token.toString()), tf.fromString(end_token.toString())),
keys_per_split);
         List<CharSequence> splits = new ArrayList<CharSequence>(tokens.size());
         for (Token token : tokens)
         {

Modified: cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilyInputFormat.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilyInputFormat.java?rev=995086&r1=995085&r2=995086&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilyInputFormat.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilyInputFormat.java Wed
Sep  8 15:14:53 2010
@@ -173,17 +173,22 @@ public class ColumnFamilyInputFormat ext
     private List<String> getSubSplits(String keyspace, String cfName, TokenRange range,
Configuration conf) throws IOException
     {
         // TODO handle failure of range replicas & retry
-        Cassandra.Client client = createConnection(range.endpoints.get(0), ConfigHelper.getRpcPort(conf),
true);
-        int splitsize = ConfigHelper.getInputSplitSize(conf);
         List<String> splits;
+        int splitsize = ConfigHelper.getInputSplitSize(conf);
         try
         {
-            splits = client.describe_splits(keyspace, cfName, range.start_token, range.end_token,
splitsize);
+            Cassandra.Client client = createConnection(range.endpoints.get(0), ConfigHelper.getRpcPort(conf),
true);
+            client.set_keyspace(keyspace);
+            splits = client.describe_splits(cfName, range.start_token, range.end_token, splitsize);
         }
         catch (TException e)
         {
             throw new RuntimeException(e);
         }
+        catch (InvalidRequestException e)
+        {
+            throw new RuntimeException(e);
+        }
         return splits;
     }
 

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=995086&r1=995085&r2=995086&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java Wed Sep  8 15:14:53
2010
@@ -600,10 +600,10 @@ public class CassandraServer implements 
         return StorageService.getPartitioner().getClass().getName();
     }
 
-    public List<String> describe_splits(String keyspace, String cfName, String start_token,
String end_token, int keys_per_split) throws TException
+    public List<String> describe_splits(String cfName, String start_token, String end_token,
int keys_per_split) throws TException
     {
         Token.TokenFactory tf = StorageService.getPartitioner().getTokenFactory();
-        List<Token> tokens = StorageService.instance.getSplits(keyspace, cfName, new
Range(tf.fromString(start_token), tf.fromString(end_token)), keys_per_split);
+        List<Token> tokens = StorageService.instance.getSplits(clientState.getKeyspace(),
cfName, new Range(tf.fromString(start_token), tf.fromString(end_token)), keys_per_split);
         List<String> splits = new ArrayList<String>(tokens.size());
         for (Token token : tokens)
         {



Mime
View raw message