diff --git a/NEWS.txt b/NEWS.txt index 97ebf8932c..207fe0b2fb 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -9,6 +9,8 @@ Configuraton Thrift API ---------- - The return type for login() is now AccessLevel. + - The get_string_property() method has been removed. + - The get_string_list_property() method has been removed. 0.6.0 diff --git a/interface/cassandra.thrift b/interface/cassandra.thrift index 265d3676e2..b1f9592962 100644 --- a/interface/cassandra.thrift +++ b/interface/cassandra.thrift @@ -456,12 +456,6 @@ service Cassandra { // Meta-APIs -- APIs to get information about the node or cluster, // rather than user data. The nodeprobe program provides usage examples. - /** get property whose value is of type string. @Deprecated */ - string get_string_property(1:required string property), - - /** get property whose value is list of strings. @Deprecated */ - list get_string_list_property(1:required string property), - /** list the defined keyspaces in this cluster */ set describe_keyspaces(), diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java index e53d8a77a5..b3bc9aea61 100644 --- a/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java +++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java @@ -25,6 +25,7 @@ package org.apache.cassandra.thrift; * */ + import java.util.List; import java.util.ArrayList; import java.util.Map; @@ -183,20 +184,6 @@ public class Cassandra { */ public void batch_mutate(String keyspace, Map>> mutation_map, ConsistencyLevel consistency_level) throws InvalidRequestException, UnavailableException, TimedOutException, TException; - /** - * get property whose value is of type string. @Deprecated - * - * @param property - */ - public String get_string_property(String property) throws TException; - - /** - * get property whose value is list of strings. @Deprecated - * - * @param property - */ - public List get_string_list_property(String property) throws TException; - /** * list the defined keyspaces in this cluster */ @@ -821,72 +808,6 @@ public class Cassandra { return; } - public String get_string_property(String property) throws TException - { - send_get_string_property(property); - return recv_get_string_property(); - } - - public void send_get_string_property(String property) throws TException - { - oprot_.writeMessageBegin(new TMessage("get_string_property", TMessageType.CALL, seqid_)); - get_string_property_args args = new get_string_property_args(); - args.property = property; - args.write(oprot_); - oprot_.writeMessageEnd(); - oprot_.getTransport().flush(); - } - - public String recv_get_string_property() throws TException - { - TMessage msg = iprot_.readMessageBegin(); - if (msg.type == TMessageType.EXCEPTION) { - TApplicationException x = TApplicationException.read(iprot_); - iprot_.readMessageEnd(); - throw x; - } - get_string_property_result result = new get_string_property_result(); - result.read(iprot_); - iprot_.readMessageEnd(); - if (result.isSetSuccess()) { - return result.success; - } - throw new TApplicationException(TApplicationException.MISSING_RESULT, "get_string_property failed: unknown result"); - } - - public List get_string_list_property(String property) throws TException - { - send_get_string_list_property(property); - return recv_get_string_list_property(); - } - - public void send_get_string_list_property(String property) throws TException - { - oprot_.writeMessageBegin(new TMessage("get_string_list_property", TMessageType.CALL, seqid_)); - get_string_list_property_args args = new get_string_list_property_args(); - args.property = property; - args.write(oprot_); - oprot_.writeMessageEnd(); - oprot_.getTransport().flush(); - } - - public List recv_get_string_list_property() throws TException - { - TMessage msg = iprot_.readMessageBegin(); - if (msg.type == TMessageType.EXCEPTION) { - TApplicationException x = TApplicationException.read(iprot_); - iprot_.readMessageEnd(); - throw x; - } - get_string_list_property_result result = new get_string_list_property_result(); - result.read(iprot_); - iprot_.readMessageEnd(); - if (result.isSetSuccess()) { - return result.success; - } - throw new TApplicationException(TApplicationException.MISSING_RESULT, "get_string_list_property failed: unknown result"); - } - public Set describe_keyspaces() throws TException { send_describe_keyspaces(); @@ -1307,8 +1228,6 @@ public class Cassandra { processMap_.put("batch_insert", new batch_insert()); processMap_.put("remove", new remove()); processMap_.put("batch_mutate", new batch_mutate()); - processMap_.put("get_string_property", new get_string_property()); - processMap_.put("get_string_list_property", new get_string_list_property()); processMap_.put("describe_keyspaces", new describe_keyspaces()); processMap_.put("describe_cluster_name", new describe_cluster_name()); processMap_.put("describe_version", new describe_version()); @@ -1853,58 +1772,6 @@ public class Cassandra { } - private class get_string_property implements ProcessFunction { - public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException - { - get_string_property_args args = new get_string_property_args(); - try { - args.read(iprot); - } catch (TProtocolException e) { - iprot.readMessageEnd(); - TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage()); - oprot.writeMessageBegin(new TMessage("get_string_property", TMessageType.EXCEPTION, seqid)); - x.write(oprot); - oprot.writeMessageEnd(); - oprot.getTransport().flush(); - return; - } - iprot.readMessageEnd(); - get_string_property_result result = new get_string_property_result(); - result.success = iface_.get_string_property(args.property); - oprot.writeMessageBegin(new TMessage("get_string_property", TMessageType.REPLY, seqid)); - result.write(oprot); - oprot.writeMessageEnd(); - oprot.getTransport().flush(); - } - - } - - private class get_string_list_property implements ProcessFunction { - public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException - { - get_string_list_property_args args = new get_string_list_property_args(); - try { - args.read(iprot); - } catch (TProtocolException e) { - iprot.readMessageEnd(); - TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage()); - oprot.writeMessageBegin(new TMessage("get_string_list_property", TMessageType.EXCEPTION, seqid)); - x.write(oprot); - oprot.writeMessageEnd(); - oprot.getTransport().flush(); - return; - } - iprot.readMessageEnd(); - get_string_list_property_result result = new get_string_list_property_result(); - result.success = iface_.get_string_list_property(args.property); - oprot.writeMessageBegin(new TMessage("get_string_list_property", TMessageType.REPLY, seqid)); - result.write(oprot); - oprot.writeMessageEnd(); - oprot.getTransport().flush(); - } - - } - private class describe_keyspaces implements ProcessFunction { public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException { @@ -15983,1171 +15850,6 @@ public class Cassandra { } - public static class get_string_property_args implements TBase, java.io.Serializable, Cloneable, Comparable { - private static final TStruct STRUCT_DESC = new TStruct("get_string_property_args"); - - private static final TField PROPERTY_FIELD_DESC = new TField("property", TType.STRING, (short)1); - - public String property; - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements TFieldIdEnum { - PROPERTY((short)1, "property"); - - private static final Map byId = new HashMap(); - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byId.put((int)field._thriftId, field); - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - return byId.get(fieldId); - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - - public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{ - put(_Fields.PROPERTY, new FieldMetaData("property", TFieldRequirementType.REQUIRED, - new FieldValueMetaData(TType.STRING))); - }}); - - static { - FieldMetaData.addStructMetaDataMap(get_string_property_args.class, metaDataMap); - } - - public get_string_property_args() { - } - - public get_string_property_args( - String property) - { - this(); - this.property = property; - } - - /** - * Performs a deep copy on other. - */ - public get_string_property_args(get_string_property_args other) { - if (other.isSetProperty()) { - this.property = other.property; - } - } - - public get_string_property_args deepCopy() { - return new get_string_property_args(this); - } - - @Deprecated - public get_string_property_args clone() { - return new get_string_property_args(this); - } - - public String getProperty() { - return this.property; - } - - public get_string_property_args setProperty(String property) { - this.property = property; - return this; - } - - public void unsetProperty() { - this.property = null; - } - - /** Returns true if field property is set (has been asigned a value) and false otherwise */ - public boolean isSetProperty() { - return this.property != null; - } - - public void setPropertyIsSet(boolean value) { - if (!value) { - this.property = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case PROPERTY: - if (value == null) { - unsetProperty(); - } else { - setProperty((String)value); - } - break; - - } - } - - public void setFieldValue(int fieldID, Object value) { - setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value); - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case PROPERTY: - return getProperty(); - - } - throw new IllegalStateException(); - } - - public Object getFieldValue(int fieldId) { - return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId)); - } - - /** 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 PROPERTY: - return isSetProperty(); - } - throw new IllegalStateException(); - } - - public boolean isSet(int fieldID) { - return isSet(_Fields.findByThriftIdOrThrow(fieldID)); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof get_string_property_args) - return this.equals((get_string_property_args)that); - return false; - } - - public boolean equals(get_string_property_args that) { - if (that == null) - return false; - - boolean this_present_property = true && this.isSetProperty(); - boolean that_present_property = true && that.isSetProperty(); - if (this_present_property || that_present_property) { - if (!(this_present_property && that_present_property)) - return false; - if (!this.property.equals(that.property)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - return 0; - } - - public int compareTo(get_string_property_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - get_string_property_args typedOther = (get_string_property_args)other; - - lastComparison = Boolean.valueOf(isSetProperty()).compareTo(typedOther.isSetProperty()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetProperty()) { lastComparison = TBaseHelper.compareTo(property, typedOther.property); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public void read(TProtocol iprot) throws TException { - TField field; - iprot.readStructBegin(); - while (true) - { - field = iprot.readFieldBegin(); - if (field.type == TType.STOP) { - break; - } - switch (field.id) { - case 1: // PROPERTY - if (field.type == TType.STRING) { - this.property = iprot.readString(); - } else { - TProtocolUtil.skip(iprot, field.type); - } - break; - default: - TProtocolUtil.skip(iprot, field.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - validate(); - } - - public void write(TProtocol oprot) throws TException { - validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (this.property != null) { - oprot.writeFieldBegin(PROPERTY_FIELD_DESC); - oprot.writeString(this.property); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("get_string_property_args("); - boolean first = true; - - sb.append("property:"); - if (this.property == null) { - sb.append("null"); - } else { - sb.append(this.property); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - if (property == null) { - throw new TProtocolException("Required field 'property' was not present! Struct: " + toString()); - } - } - - } - - public static class get_string_property_result implements TBase, java.io.Serializable, Cloneable, Comparable { - private static final TStruct STRUCT_DESC = new TStruct("get_string_property_result"); - - private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.STRING, (short)0); - - public String success; - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byId = new HashMap(); - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byId.put((int)field._thriftId, field); - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - return byId.get(fieldId); - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - - public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{ - put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, - new FieldValueMetaData(TType.STRING))); - }}); - - static { - FieldMetaData.addStructMetaDataMap(get_string_property_result.class, metaDataMap); - } - - public get_string_property_result() { - } - - public get_string_property_result( - String success) - { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public get_string_property_result(get_string_property_result other) { - if (other.isSetSuccess()) { - this.success = other.success; - } - } - - public get_string_property_result deepCopy() { - return new get_string_property_result(this); - } - - @Deprecated - public get_string_property_result clone() { - return new get_string_property_result(this); - } - - public String getSuccess() { - return this.success; - } - - public get_string_property_result setSuccess(String success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been asigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((String)value); - } - break; - - } - } - - public void setFieldValue(int fieldID, Object value) { - setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value); - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - public Object getFieldValue(int fieldId) { - return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId)); - } - - /** 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 SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - public boolean isSet(int fieldID) { - return isSet(_Fields.findByThriftIdOrThrow(fieldID)); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof get_string_property_result) - return this.equals((get_string_property_result)that); - return false; - } - - public boolean equals(get_string_property_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - return 0; - } - - public int compareTo(get_string_property_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - get_string_property_result typedOther = (get_string_property_result)other; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { lastComparison = TBaseHelper.compareTo(success, typedOther.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public void read(TProtocol iprot) throws TException { - TField field; - iprot.readStructBegin(); - while (true) - { - field = iprot.readFieldBegin(); - if (field.type == TType.STOP) { - break; - } - switch (field.id) { - case 0: // SUCCESS - if (field.type == TType.STRING) { - this.success = iprot.readString(); - } else { - TProtocolUtil.skip(iprot, field.type); - } - break; - default: - TProtocolUtil.skip(iprot, field.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - validate(); - } - - public void write(TProtocol oprot) throws TException { - oprot.writeStructBegin(STRUCT_DESC); - - if (this.isSetSuccess()) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeString(this.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("get_string_property_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - } - - } - - public static class get_string_list_property_args implements TBase, java.io.Serializable, Cloneable, Comparable { - private static final TStruct STRUCT_DESC = new TStruct("get_string_list_property_args"); - - private static final TField PROPERTY_FIELD_DESC = new TField("property", TType.STRING, (short)1); - - public String property; - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements TFieldIdEnum { - PROPERTY((short)1, "property"); - - private static final Map byId = new HashMap(); - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byId.put((int)field._thriftId, field); - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - return byId.get(fieldId); - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - - public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{ - put(_Fields.PROPERTY, new FieldMetaData("property", TFieldRequirementType.REQUIRED, - new FieldValueMetaData(TType.STRING))); - }}); - - static { - FieldMetaData.addStructMetaDataMap(get_string_list_property_args.class, metaDataMap); - } - - public get_string_list_property_args() { - } - - public get_string_list_property_args( - String property) - { - this(); - this.property = property; - } - - /** - * Performs a deep copy on other. - */ - public get_string_list_property_args(get_string_list_property_args other) { - if (other.isSetProperty()) { - this.property = other.property; - } - } - - public get_string_list_property_args deepCopy() { - return new get_string_list_property_args(this); - } - - @Deprecated - public get_string_list_property_args clone() { - return new get_string_list_property_args(this); - } - - public String getProperty() { - return this.property; - } - - public get_string_list_property_args setProperty(String property) { - this.property = property; - return this; - } - - public void unsetProperty() { - this.property = null; - } - - /** Returns true if field property is set (has been asigned a value) and false otherwise */ - public boolean isSetProperty() { - return this.property != null; - } - - public void setPropertyIsSet(boolean value) { - if (!value) { - this.property = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case PROPERTY: - if (value == null) { - unsetProperty(); - } else { - setProperty((String)value); - } - break; - - } - } - - public void setFieldValue(int fieldID, Object value) { - setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value); - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case PROPERTY: - return getProperty(); - - } - throw new IllegalStateException(); - } - - public Object getFieldValue(int fieldId) { - return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId)); - } - - /** 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 PROPERTY: - return isSetProperty(); - } - throw new IllegalStateException(); - } - - public boolean isSet(int fieldID) { - return isSet(_Fields.findByThriftIdOrThrow(fieldID)); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof get_string_list_property_args) - return this.equals((get_string_list_property_args)that); - return false; - } - - public boolean equals(get_string_list_property_args that) { - if (that == null) - return false; - - boolean this_present_property = true && this.isSetProperty(); - boolean that_present_property = true && that.isSetProperty(); - if (this_present_property || that_present_property) { - if (!(this_present_property && that_present_property)) - return false; - if (!this.property.equals(that.property)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - return 0; - } - - public int compareTo(get_string_list_property_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - get_string_list_property_args typedOther = (get_string_list_property_args)other; - - lastComparison = Boolean.valueOf(isSetProperty()).compareTo(typedOther.isSetProperty()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetProperty()) { lastComparison = TBaseHelper.compareTo(property, typedOther.property); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public void read(TProtocol iprot) throws TException { - TField field; - iprot.readStructBegin(); - while (true) - { - field = iprot.readFieldBegin(); - if (field.type == TType.STOP) { - break; - } - switch (field.id) { - case 1: // PROPERTY - if (field.type == TType.STRING) { - this.property = iprot.readString(); - } else { - TProtocolUtil.skip(iprot, field.type); - } - break; - default: - TProtocolUtil.skip(iprot, field.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - validate(); - } - - public void write(TProtocol oprot) throws TException { - validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (this.property != null) { - oprot.writeFieldBegin(PROPERTY_FIELD_DESC); - oprot.writeString(this.property); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("get_string_list_property_args("); - boolean first = true; - - sb.append("property:"); - if (this.property == null) { - sb.append("null"); - } else { - sb.append(this.property); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - if (property == null) { - throw new TProtocolException("Required field 'property' was not present! Struct: " + toString()); - } - } - - } - - public static class get_string_list_property_result implements TBase, java.io.Serializable, Cloneable, Comparable { - private static final TStruct STRUCT_DESC = new TStruct("get_string_list_property_result"); - - private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.LIST, (short)0); - - public List success; - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byId = new HashMap(); - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byId.put((int)field._thriftId, field); - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - return byId.get(fieldId); - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - - public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{ - put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, - new ListMetaData(TType.LIST, - new FieldValueMetaData(TType.STRING)))); - }}); - - static { - FieldMetaData.addStructMetaDataMap(get_string_list_property_result.class, metaDataMap); - } - - public get_string_list_property_result() { - } - - public get_string_list_property_result( - List success) - { - this(); - this.success = success; - } - - /** - * Performs a deep copy on other. - */ - public get_string_list_property_result(get_string_list_property_result other) { - if (other.isSetSuccess()) { - List __this__success = new ArrayList(); - for (String other_element : other.success) { - __this__success.add(other_element); - } - this.success = __this__success; - } - } - - public get_string_list_property_result deepCopy() { - return new get_string_list_property_result(this); - } - - @Deprecated - public get_string_list_property_result clone() { - return new get_string_list_property_result(this); - } - - public int getSuccessSize() { - return (this.success == null) ? 0 : this.success.size(); - } - - public java.util.Iterator getSuccessIterator() { - return (this.success == null) ? null : this.success.iterator(); - } - - public void addToSuccess(String elem) { - if (this.success == null) { - this.success = new ArrayList(); - } - this.success.add(elem); - } - - public List getSuccess() { - return this.success; - } - - public get_string_list_property_result setSuccess(List success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been asigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((List)value); - } - break; - - } - } - - public void setFieldValue(int fieldID, Object value) { - setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value); - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - } - throw new IllegalStateException(); - } - - public Object getFieldValue(int fieldId) { - return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId)); - } - - /** 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 SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - public boolean isSet(int fieldID) { - return isSet(_Fields.findByThriftIdOrThrow(fieldID)); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof get_string_list_property_result) - return this.equals((get_string_list_property_result)that); - return false; - } - - public boolean equals(get_string_list_property_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - return 0; - } - - public int compareTo(get_string_list_property_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - get_string_list_property_result typedOther = (get_string_list_property_result)other; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { lastComparison = TBaseHelper.compareTo(success, typedOther.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public void read(TProtocol iprot) throws TException { - TField field; - iprot.readStructBegin(); - while (true) - { - field = iprot.readFieldBegin(); - if (field.type == TType.STOP) { - break; - } - switch (field.id) { - case 0: // SUCCESS - if (field.type == TType.LIST) { - { - TList _list86 = iprot.readListBegin(); - this.success = new ArrayList(_list86.size); - for (int _i87 = 0; _i87 < _list86.size; ++_i87) - { - String _elem88; - _elem88 = iprot.readString(); - this.success.add(_elem88); - } - iprot.readListEnd(); - } - } else { - TProtocolUtil.skip(iprot, field.type); - } - break; - default: - TProtocolUtil.skip(iprot, field.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - validate(); - } - - public void write(TProtocol oprot) throws TException { - oprot.writeStructBegin(STRUCT_DESC); - - if (this.isSetSuccess()) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - { - oprot.writeListBegin(new TList(TType.STRING, this.success.size())); - for (String _iter89 : this.success) - { - oprot.writeString(_iter89); - } - oprot.writeListEnd(); - } - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("get_string_list_property_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - } - - } - public static class describe_keyspaces_args implements TBase, java.io.Serializable, Cloneable, Comparable { private static final TStruct STRUCT_DESC = new TStruct("describe_keyspaces_args"); @@ -17569,13 +16271,13 @@ public class Cassandra { case 0: // SUCCESS if (field.type == TType.SET) { { - TSet _set90 = iprot.readSetBegin(); - this.success = new HashSet(2*_set90.size); - for (int _i91 = 0; _i91 < _set90.size; ++_i91) + TSet _set86 = iprot.readSetBegin(); + this.success = new HashSet(2*_set86.size); + for (int _i87 = 0; _i87 < _set86.size; ++_i87) { - String _elem92; - _elem92 = iprot.readString(); - this.success.add(_elem92); + String _elem88; + _elem88 = iprot.readString(); + this.success.add(_elem88); } iprot.readSetEnd(); } @@ -17601,9 +16303,9 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeSetBegin(new TSet(TType.STRING, this.success.size())); - for (String _iter93 : this.success) + for (String _iter89 : this.success) { - oprot.writeString(_iter93); + oprot.writeString(_iter89); } oprot.writeSetEnd(); } @@ -19110,14 +17812,14 @@ public class Cassandra { case 0: // SUCCESS if (field.type == TType.LIST) { { - TList _list94 = iprot.readListBegin(); - this.success = new ArrayList(_list94.size); - for (int _i95 = 0; _i95 < _list94.size; ++_i95) + TList _list90 = iprot.readListBegin(); + this.success = new ArrayList(_list90.size); + for (int _i91 = 0; _i91 < _list90.size; ++_i91) { - TokenRange _elem96; - _elem96 = new TokenRange(); - _elem96.read(iprot); - this.success.add(_elem96); + TokenRange _elem92; + _elem92 = new TokenRange(); + _elem92.read(iprot); + this.success.add(_elem92); } iprot.readListEnd(); } @@ -19143,9 +17845,9 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new TList(TType.STRUCT, this.success.size())); - for (TokenRange _iter97 : this.success) + for (TokenRange _iter93 : this.success) { - _iter97.write(oprot); + _iter93.write(oprot); } oprot.writeListEnd(); } @@ -19766,27 +18468,27 @@ public class Cassandra { case 0: // SUCCESS if (field.type == TType.MAP) { { - TMap _map98 = iprot.readMapBegin(); - this.success = new HashMap>(2*_map98.size); - for (int _i99 = 0; _i99 < _map98.size; ++_i99) + TMap _map94 = iprot.readMapBegin(); + this.success = new HashMap>(2*_map94.size); + for (int _i95 = 0; _i95 < _map94.size; ++_i95) { - String _key100; - Map _val101; - _key100 = iprot.readString(); + String _key96; + Map _val97; + _key96 = iprot.readString(); { - TMap _map102 = iprot.readMapBegin(); - _val101 = new HashMap(2*_map102.size); - for (int _i103 = 0; _i103 < _map102.size; ++_i103) + TMap _map98 = iprot.readMapBegin(); + _val97 = new HashMap(2*_map98.size); + for (int _i99 = 0; _i99 < _map98.size; ++_i99) { - String _key104; - String _val105; - _key104 = iprot.readString(); - _val105 = iprot.readString(); - _val101.put(_key104, _val105); + String _key100; + String _val101; + _key100 = iprot.readString(); + _val101 = iprot.readString(); + _val97.put(_key100, _val101); } iprot.readMapEnd(); } - this.success.put(_key100, _val101); + this.success.put(_key96, _val97); } iprot.readMapEnd(); } @@ -19820,15 +18522,15 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeMapBegin(new TMap(TType.STRING, TType.MAP, this.success.size())); - for (Map.Entry> _iter106 : this.success.entrySet()) + for (Map.Entry> _iter102 : this.success.entrySet()) { - oprot.writeString(_iter106.getKey()); + oprot.writeString(_iter102.getKey()); { - oprot.writeMapBegin(new TMap(TType.STRING, TType.STRING, _iter106.getValue().size())); - for (Map.Entry _iter107 : _iter106.getValue().entrySet()) + oprot.writeMapBegin(new TMap(TType.STRING, TType.STRING, _iter102.getValue().size())); + for (Map.Entry _iter103 : _iter102.getValue().entrySet()) { - oprot.writeString(_iter107.getKey()); - oprot.writeString(_iter107.getValue()); + oprot.writeString(_iter103.getKey()); + oprot.writeString(_iter103.getValue()); } oprot.writeMapEnd(); } @@ -20584,13 +19286,13 @@ public class Cassandra { case 0: // SUCCESS if (field.type == TType.LIST) { { - TList _list108 = iprot.readListBegin(); - this.success = new ArrayList(_list108.size); - for (int _i109 = 0; _i109 < _list108.size; ++_i109) + TList _list104 = iprot.readListBegin(); + this.success = new ArrayList(_list104.size); + for (int _i105 = 0; _i105 < _list104.size; ++_i105) { - String _elem110; - _elem110 = iprot.readString(); - this.success.add(_elem110); + String _elem106; + _elem106 = iprot.readString(); + this.success.add(_elem106); } iprot.readListEnd(); } @@ -20616,9 +19318,9 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new TList(TType.STRING, this.success.size())); - for (String _iter111 : this.success) + for (String _iter107 : this.success) { - oprot.writeString(_iter111); + oprot.writeString(_iter107); } oprot.writeListEnd(); } diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java index bcf2789ffd..4272e91894 100644 --- a/interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java +++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java @@ -24,6 +24,8 @@ package org.apache.cassandra.thrift; * under the License. * */ + + import java.util.List; import java.util.ArrayList; import java.util.Map; diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/KsDef.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/KsDef.java index f3f8d3ab0b..70b047be99 100644 --- a/interface/thrift/gen-java/org/apache/cassandra/thrift/KsDef.java +++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/KsDef.java @@ -24,6 +24,8 @@ package org.apache.cassandra.thrift; * under the License. * */ + + import java.util.List; import java.util.ArrayList; import java.util.Map; diff --git a/src/java/org/apache/cassandra/cli/Cli.g b/src/java/org/apache/cassandra/cli/Cli.g index fbb3a5d2dd..3799311f15 100644 --- a/src/java/org/apache/cassandra/cli/Cli.g +++ b/src/java/org/apache/cassandra/cli/Cli.g @@ -40,7 +40,6 @@ tokens { NODE_HELP; NODE_NO_OP; NODE_SHOW_CLUSTER_NAME; - NODE_SHOW_CONFIG_FILE; NODE_SHOW_VERSION; NODE_SHOW_TABLES; NODE_THRIFT_GET; @@ -115,7 +114,6 @@ delStmt showStmt : showClusterName | showVersion - | showConfigFile | showTables ; @@ -123,10 +121,6 @@ showClusterName : K_SHOW K_CLUSTER K_NAME -> ^(NODE_SHOW_CLUSTER_NAME) ; -showConfigFile - : K_SHOW K_CONFIG K_FILE -> ^(NODE_SHOW_CONFIG_FILE) - ; - showVersion : K_SHOW K_VERSION -> ^(NODE_SHOW_VERSION) ; diff --git a/src/java/org/apache/cassandra/cli/CliClient.java b/src/java/org/apache/cassandra/cli/CliClient.java index 4f03c85c7b..1f1f9fb0cb 100644 --- a/src/java/org/apache/cassandra/cli/CliClient.java +++ b/src/java/org/apache/cassandra/cli/CliClient.java @@ -71,13 +71,10 @@ public class CliClient executeCount(ast); break; case CliParser.NODE_SHOW_CLUSTER_NAME: - executeShowProperty(ast, "cluster name"); - break; - case CliParser.NODE_SHOW_CONFIG_FILE: - executeShowProperty(ast, "config file"); + executeShowClusterName(); break; case CliParser.NODE_SHOW_VERSION: - executeShowProperty(ast, "version"); + executeShowVersion(); break; case CliParser.NODE_SHOW_TABLES: executeShowTables(ast); @@ -111,7 +108,6 @@ public class CliClient css_.out.println("describe keyspace Describe keyspace."); css_.out.println("exit Exit CLI."); css_.out.println("quit Exit CLI."); - css_.out.println("show config file Display contents of config file."); css_.out.println("show cluster name Display cluster name."); css_.out.println("show keyspaces Show list of keyspaces."); css_.out.println("show api version Show server API version."); @@ -420,14 +416,19 @@ public class CliClient css_.out.println("Value inserted."); } - - private void executeShowProperty(CommonTree ast, String propertyName) throws TException + + private void executeShowClusterName() throws TException { if (!CliMain.isConnected()) return; - - String propertyValue = thriftClient_.get_string_property(propertyName); - css_.out.println(propertyValue); + css_.out.println(thriftClient_.describe_cluster_name()); + } + + private void executeShowVersion() throws TException + { + if (!CliMain.isConnected()) + return; + css_.out.println(thriftClient_.describe_version()); } // process "show tables" statement @@ -436,7 +437,7 @@ public class CliClient if (!CliMain.isConnected()) return; - List tables = thriftClient_.get_string_list_property("keyspaces"); + Set tables = thriftClient_.describe_keyspaces(); for (String table : tables) { css_.out.println(table); diff --git a/src/java/org/apache/cassandra/cli/CliCompleter.java b/src/java/org/apache/cassandra/cli/CliCompleter.java index 98192a126f..a73340b178 100644 --- a/src/java/org/apache/cassandra/cli/CliCompleter.java +++ b/src/java/org/apache/cassandra/cli/CliCompleter.java @@ -27,7 +27,6 @@ public class CliCompleter extends SimpleCompletor "exit", "help", "quit", - "show config file", "show cluster name", "show keyspaces", "show api version", diff --git a/src/java/org/apache/cassandra/cli/CliMain.java b/src/java/org/apache/cassandra/cli/CliMain.java index db707e7ca6..31c8db2c71 100644 --- a/src/java/org/apache/cassandra/cli/CliMain.java +++ b/src/java/org/apache/cassandra/cli/CliMain.java @@ -134,7 +134,7 @@ public class CliMain try { - clusterName = thriftClient_.get_string_property("cluster name"); + clusterName = thriftClient_.describe_cluster_name(); } catch (Exception e) { @@ -150,7 +150,7 @@ public class CliMain // Extend the completer with keyspace and column family data. try { - for (String keyspace : thriftClient_.get_string_list_property("keyspaces")) + for (String keyspace : thriftClient_.describe_keyspaces()) { // Ignore system column family if (keyspace.equals(SYSTEM_TABLE)) diff --git a/src/java/org/apache/cassandra/client/RingCache.java b/src/java/org/apache/cassandra/client/RingCache.java index f69b4b22db..23f9721c64 100644 --- a/src/java/org/apache/cassandra/client/RingCache.java +++ b/src/java/org/apache/cassandra/client/RingCache.java @@ -29,13 +29,12 @@ import java.net.UnknownHostException; import org.apache.cassandra.service.StorageService; import org.apache.cassandra.thrift.Cassandra; -import org.apache.cassandra.thrift.CassandraServer; +import org.apache.cassandra.thrift.TokenRange; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.thrift.TException; import org.apache.thrift.protocol.TBinaryProtocol; import org.apache.thrift.transport.TSocket; -import org.json.simple.JSONValue; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; @@ -51,14 +50,16 @@ public class RingCache private Set seeds_ = new HashSet(); final private int port_= DatabaseDescriptor.getRpcPort(); final private static IPartitioner partitioner_ = DatabaseDescriptor.getPartitioner(); + private final String keyspace; private TokenMetadata tokenMetadata; - public RingCache() + public RingCache(String keyspace) { for (InetAddress seed : DatabaseDescriptor.getSeeds()) { seeds_.add(seed.getHostAddress()); } + this.keyspace = keyspace; refreshEndPointMap(); } @@ -73,13 +74,14 @@ public class RingCache Cassandra.Client client = new Cassandra.Client(binaryProtocol); socket.open(); - Map tokenToHostMap = (Map) JSONValue.parse(client.get_string_property(CassandraServer.TOKEN_MAP)); - + List ring = client.describe_ring(keyspace); BiMap tokenEndpointMap = HashBiMap.create(); - for (Map.Entry entry : tokenToHostMap.entrySet()) + + for (TokenRange range : ring) { - Token token = StorageService.getPartitioner().getTokenFactory().fromString(entry.getKey()); - String host = entry.getValue(); + Token token = StorageService.getPartitioner().getTokenFactory().fromString(range.start_token); + String host = range.endpoints.get(0); + try { tokenEndpointMap.put(token, InetAddress.getByName(host)); @@ -102,11 +104,11 @@ public class RingCache } } - public List getEndPoint(String table, String key) + public List getEndPoint(String key) { if (tokenMetadata == null) throw new RuntimeException("Must refresh endpoints before looking up a key."); - AbstractReplicationStrategy strat = StorageService.getReplicationStrategy(tokenMetadata, table); - return strat.getNaturalEndpoints(partitioner_.getToken(key), table); + AbstractReplicationStrategy strat = StorageService.getReplicationStrategy(tokenMetadata, keyspace); + return strat.getNaturalEndpoints(partitioner_.getToken(key), keyspace); } } diff --git a/src/java/org/apache/cassandra/thrift/CassandraServer.java b/src/java/org/apache/cassandra/thrift/CassandraServer.java index 4b6fb6aac3..b47e74350e 100644 --- a/src/java/org/apache/cassandra/thrift/CassandraServer.java +++ b/src/java/org/apache/cassandra/thrift/CassandraServer.java @@ -18,8 +18,6 @@ package org.apache.cassandra.thrift; -import java.io.BufferedInputStream; -import java.io.FileInputStream; import java.io.IOException; import java.util.*; import java.util.concurrent.Future; @@ -55,7 +53,6 @@ import org.apache.cassandra.dht.Token; import org.apache.cassandra.service.StorageProxy; import org.apache.cassandra.service.StorageService; import org.apache.thrift.TException; -import org.json.simple.JSONValue; public class CassandraServer implements Cassandra.Iface { @@ -488,57 +485,6 @@ public class CassandraServer implements Cassandra.Iface } } - public String get_string_property(String propertyName) - { - if (propertyName.equals("cluster name")) - { - return DatabaseDescriptor.getClusterName(); - } - else if (propertyName.equals("config file")) - { - String filename = DatabaseDescriptor.getConfigFileName(); - try - { - StringBuilder fileData = new StringBuilder(8192); - BufferedInputStream stream = new BufferedInputStream(new FileInputStream(filename)); - byte[] buf = new byte[1024]; - int numRead; - while( (numRead = stream.read(buf)) != -1) - { - String str = new String(buf, 0, numRead); - fileData.append(str); - } - stream.close(); - return fileData.toString(); - } - catch (IOException e) - { - return "file not found!"; - } - } - else if (propertyName.equals(TOKEN_MAP)) - { - return JSONValue.toJSONString(storageService.getStringEndpointMap()); - } - else if (propertyName.equals("version")) - { - return Constants.VERSION; - } - else - { - return "?"; - } - } - - public List get_string_list_property(String propertyName) - { - if (propertyName.equals("keyspaces")) - { - return new ArrayList(DatabaseDescriptor.getTables()); - } - return Collections.emptyList(); - } - public Map> describe_keyspace(String table) throws NotFoundException { Map> columnFamiliesMap = new HashMap>(); diff --git a/test/unit/org/apache/cassandra/client/TestRingCache.java b/test/unit/org/apache/cassandra/client/TestRingCache.java index 16b5b8f727..445d7d1da0 100644 --- a/test/unit/org/apache/cassandra/client/TestRingCache.java +++ b/test/unit/org/apache/cassandra/client/TestRingCache.java @@ -36,11 +36,12 @@ import org.apache.thrift.transport.TTransport; public class TestRingCache { private static RingCache ringCache; + private static String keyspace = "Keyspace1"; private static Cassandra.Client thriftClient; static { - ringCache = new RingCache(); + ringCache = new RingCache(keyspace); } private static void setup(String server, int port) throws Exception @@ -65,20 +66,18 @@ public class TestRingCache */ public static void main(String[] args) throws Throwable { - String table; int minRow; int maxRow; String rowPrefix; if (args.length > 0) { - table = args[0]; + keyspace = args[0]; rowPrefix = args[1]; minRow = Integer.parseInt(args[2]); maxRow = minRow + 1; } else { - table = "Keyspace1"; minRow = 1; maxRow = 10; rowPrefix = "row"; @@ -89,7 +88,7 @@ public class TestRingCache String row = rowPrefix + nRows; ColumnPath col = new ColumnPath("Standard1").setSuper_column(null).setColumn("col1".getBytes()); - List endPoints = ringCache.getEndPoint(table, row); + List endPoints = ringCache.getEndPoint(row); String hosts=""; for (int i = 0; i < endPoints.size(); i++) hosts = hosts + ((i > 0) ? "," : "") + endPoints.get(i); @@ -97,8 +96,8 @@ public class TestRingCache // now, read the row back directly from the host owning the row locally setup(endPoints.get(0).getHostAddress(), DatabaseDescriptor.getRpcPort()); - thriftClient.insert(table, row, col, "val1".getBytes(), 1, ConsistencyLevel.ONE); - Column column=thriftClient.get(table, row, col, ConsistencyLevel.ONE).column; + thriftClient.insert(keyspace, row, col, "val1".getBytes(), 1, ConsistencyLevel.ONE); + Column column=thriftClient.get(keyspace, row, col, ConsistencyLevel.ONE).column; System.out.println("read row " + row + " " + new String(column.name) + ":" + new String(column.value) + ":" + column.timestamp); }