Author: jbellis
Date: Wed Apr 21 20:39:28 2010
New Revision: 936495
URL: http://svn.apache.org/viewvc?rev=936495&view=rev
Log:
r/m now-unused snitch_class from KsDef thrift struct. patch by jbellis for
CASSANDRA-986
Modified:
cassandra/trunk/interface/cassandra.thrift
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/KsDef.java
cassandra/trunk/test/system/__init__.py
cassandra/trunk/test/system/test_thrift_server.py
Modified: cassandra/trunk/interface/cassandra.thrift
URL:
http://svn.apache.org/viewvc/cassandra/trunk/interface/cassandra.thrift?rev=936495&r1=936494&r2=936495&view=diff
==============================================================================
--- cassandra/trunk/interface/cassandra.thrift (original)
+++ cassandra/trunk/interface/cassandra.thrift Wed Apr 21 20:39:28 2010
@@ -320,7 +320,6 @@ struct KsDef {
1: required string name,
2: required string strategy_class,
3: required i32 replication_factor,
- 4: required string snitch_class,
5: required list<CfDef> cf_defs,
}
Modified:
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java
URL:
http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java?rev=936495&r1=936494&r2=936495&view=diff
==============================================================================
---
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java
(original)
+++
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java
Wed Apr 21 20:39:28 2010
@@ -46,13 +46,10 @@ import org.apache.thrift.protocol.*;
/**
* Basic unit of data within a ColumnFamily.
- * @param name. A column name can act both as structure (a label) or as data
(like value). Regardless, the name of the column
- * is used as a key to its value.
- * @param value. Some data
- * @param timestamp. Used to record when data was sent to be written.
- * @param ttl. A delay (in seconds) after which the column will be
automatically deleted. If this parameter is not
- * provided or is <= 0, the column will never be deleted
automatically (and will have no ttl when queried).
- * Note that, if set, the column will be deleted from a node ttl
seconds after the column reach the node.
+ * @param name, the name by which this column is set and retrieved. Maximum
64KB long.
+ * @param value. The data associated with the name. Maximum 2GB long, but in
practice you should limit it to small numbers of MB (since Thrift must read the
full value into memory to operate on it).
+ * @param timestamp. The highest timestamp associated with the given column
name is the one whose value the system will converge to. No other assumptions
are made about what the timestamp represents, but using
microseconds-since-epoch is customary.
+ * @param ttl. An optional, positive delay (in seconds) after which the column
will be automatically deleted.
*/
public class Column implements TBase<Column._Fields>, java.io.Serializable,
Cloneable, Comparable<Column> {
private static final TStruct STRUCT_DESC = new TStruct("Column");
Modified:
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/KsDef.java
URL:
http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/KsDef.java?rev=936495&r1=936494&r2=936495&view=diff
==============================================================================
---
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/KsDef.java
(original)
+++
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/KsDef.java
Wed Apr 21 20:39:28 2010
@@ -50,13 +50,11 @@ public class KsDef implements TBase<KsDe
private static final TField NAME_FIELD_DESC = new TField("name",
TType.STRING, (short)1);
private static final TField STRATEGY_CLASS_FIELD_DESC = new
TField("strategy_class", TType.STRING, (short)2);
private static final TField REPLICATION_FACTOR_FIELD_DESC = new
TField("replication_factor", TType.I32, (short)3);
- private static final TField SNITCH_CLASS_FIELD_DESC = new
TField("snitch_class", TType.STRING, (short)4);
private static final TField CF_DEFS_FIELD_DESC = new TField("cf_defs",
TType.LIST, (short)5);
public String name;
public String strategy_class;
public int replication_factor;
- public String snitch_class;
public List<CfDef> cf_defs;
/** The set of fields this struct contains, along with convenience methods
for finding and manipulating them. */
@@ -64,7 +62,6 @@ public class KsDef implements TBase<KsDe
NAME((short)1, "name"),
STRATEGY_CLASS((short)2, "strategy_class"),
REPLICATION_FACTOR((short)3, "replication_factor"),
- SNITCH_CLASS((short)4, "snitch_class"),
CF_DEFS((short)5, "cf_defs");
private static final Map<Integer, _Fields> byId = new HashMap<Integer,
_Fields>();
@@ -129,8 +126,6 @@ public class KsDef implements TBase<KsDe
new FieldValueMetaData(TType.STRING)));
put(_Fields.REPLICATION_FACTOR, new FieldMetaData("replication_factor",
TFieldRequirementType.REQUIRED,
new FieldValueMetaData(TType.I32)));
- put(_Fields.SNITCH_CLASS, new FieldMetaData("snitch_class",
TFieldRequirementType.REQUIRED,
- new FieldValueMetaData(TType.STRING)));
put(_Fields.CF_DEFS, new FieldMetaData("cf_defs",
TFieldRequirementType.REQUIRED,
new ListMetaData(TType.LIST,
new StructMetaData(TType.STRUCT, CfDef.class))));
@@ -147,7 +142,6 @@ public class KsDef implements TBase<KsDe
String name,
String strategy_class,
int replication_factor,
- String snitch_class,
List<CfDef> cf_defs)
{
this();
@@ -155,7 +149,6 @@ public class KsDef implements TBase<KsDe
this.strategy_class = strategy_class;
this.replication_factor = replication_factor;
setReplication_factorIsSet(true);
- this.snitch_class = snitch_class;
this.cf_defs = cf_defs;
}
@@ -172,9 +165,6 @@ public class KsDef implements TBase<KsDe
this.strategy_class = other.strategy_class;
}
this.replication_factor = other.replication_factor;
- if (other.isSetSnitch_class()) {
- this.snitch_class = other.snitch_class;
- }
if (other.isSetCf_defs()) {
List<CfDef> __this__cf_defs = new ArrayList<CfDef>();
for (CfDef other_element : other.cf_defs) {
@@ -264,30 +254,6 @@ public class KsDef implements TBase<KsDe
__isset_bit_vector.set(__REPLICATION_FACTOR_ISSET_ID, value);
}
- public String getSnitch_class() {
- return this.snitch_class;
- }
-
- public KsDef setSnitch_class(String snitch_class) {
- this.snitch_class = snitch_class;
- return this;
- }
-
- public void unsetSnitch_class() {
- this.snitch_class = null;
- }
-
- /** Returns true if field snitch_class is set (has been asigned a value) and
false otherwise */
- public boolean isSetSnitch_class() {
- return this.snitch_class != null;
- }
-
- public void setSnitch_classIsSet(boolean value) {
- if (!value) {
- this.snitch_class = null;
- }
- }
-
public int getCf_defsSize() {
return (this.cf_defs == null) ? 0 : this.cf_defs.size();
}
@@ -353,14 +319,6 @@ public class KsDef implements TBase<KsDe
}
break;
- case SNITCH_CLASS:
- if (value == null) {
- unsetSnitch_class();
- } else {
- setSnitch_class((String)value);
- }
- break;
-
case CF_DEFS:
if (value == null) {
unsetCf_defs();
@@ -387,9 +345,6 @@ public class KsDef implements TBase<KsDe
case REPLICATION_FACTOR:
return new Integer(getReplication_factor());
- case SNITCH_CLASS:
- return getSnitch_class();
-
case CF_DEFS:
return getCf_defs();
@@ -410,8 +365,6 @@ public class KsDef implements TBase<KsDe
return isSetStrategy_class();
case REPLICATION_FACTOR:
return isSetReplication_factor();
- case SNITCH_CLASS:
- return isSetSnitch_class();
case CF_DEFS:
return isSetCf_defs();
}
@@ -462,15 +415,6 @@ public class KsDef implements TBase<KsDe
return false;
}
- boolean this_present_snitch_class = true && this.isSetSnitch_class();
- boolean that_present_snitch_class = true && that.isSetSnitch_class();
- if (this_present_snitch_class || that_present_snitch_class) {
- if (!(this_present_snitch_class && that_present_snitch_class))
- return false;
- if (!this.snitch_class.equals(that.snitch_class))
- return false;
- }
-
boolean this_present_cf_defs = true && this.isSetCf_defs();
boolean that_present_cf_defs = true && that.isSetCf_defs();
if (this_present_cf_defs || that_present_cf_defs) {
@@ -523,15 +467,6 @@ public class KsDef implements TBase<KsDe
return lastComparison;
}
}
- lastComparison =
Boolean.valueOf(isSetSnitch_class()).compareTo(typedOther.isSetSnitch_class());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetSnitch_class()) { lastComparison =
TBaseHelper.compareTo(snitch_class, typedOther.snitch_class);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
lastComparison =
Boolean.valueOf(isSetCf_defs()).compareTo(typedOther.isSetCf_defs());
if (lastComparison != 0) {
return lastComparison;
@@ -576,13 +511,6 @@ public class KsDef implements TBase<KsDe
TProtocolUtil.skip(iprot, field.type);
}
break;
- case 4: // SNITCH_CLASS
- if (field.type == TType.STRING) {
- this.snitch_class = iprot.readString();
- } else {
- TProtocolUtil.skip(iprot, field.type);
- }
- break;
case 5: // CF_DEFS
if (field.type == TType.LIST) {
{
@@ -632,11 +560,6 @@ public class KsDef implements TBase<KsDe
oprot.writeFieldBegin(REPLICATION_FACTOR_FIELD_DESC);
oprot.writeI32(this.replication_factor);
oprot.writeFieldEnd();
- if (this.snitch_class != null) {
- oprot.writeFieldBegin(SNITCH_CLASS_FIELD_DESC);
- oprot.writeString(this.snitch_class);
- oprot.writeFieldEnd();
- }
if (this.cf_defs != null) {
oprot.writeFieldBegin(CF_DEFS_FIELD_DESC);
{
@@ -678,14 +601,6 @@ public class KsDef implements TBase<KsDe
sb.append(this.replication_factor);
first = false;
if (!first) sb.append(", ");
- sb.append("snitch_class:");
- if (this.snitch_class == null) {
- sb.append("null");
- } else {
- sb.append(this.snitch_class);
- }
- first = false;
- if (!first) sb.append(", ");
sb.append("cf_defs:");
if (this.cf_defs == null) {
sb.append("null");
@@ -706,9 +621,6 @@ public class KsDef implements TBase<KsDe
throw new TProtocolException("Required field 'strategy_class' was not
present! Struct: " + toString());
}
// alas, we cannot check 'replication_factor' because it's a primitive and
you chose the non-beans generator.
- if (snitch_class == null) {
- throw new TProtocolException("Required field 'snitch_class' was not
present! Struct: " + toString());
- }
if (cf_defs == null) {
throw new TProtocolException("Required field 'cf_defs' was not present!
Struct: " + toString());
}
Modified: cassandra/trunk/test/system/__init__.py
URL:
http://svn.apache.org/viewvc/cassandra/trunk/test/system/__init__.py?rev=936495&r1=936494&r2=936495&view=diff
==============================================================================
--- cassandra/trunk/test/system/__init__.py (original)
+++ cassandra/trunk/test/system/__init__.py Wed Apr 21 20:39:28 2010
@@ -142,7 +142,7 @@ class ThriftTester(BaseTester):
self.client.transport.close()
def define_schema(self):
- keyspace1 = Cassandra.KsDef('Keyspace1',
'org.apache.cassandra.locator.RackUnawareStrategy', 1,
'org.apache.cassandra.locator.EndpointSnitch',
+ keyspace1 = Cassandra.KsDef('Keyspace1',
'org.apache.cassandra.locator.RackUnawareStrategy', 1,
[
Cassandra.CfDef('Keyspace1', 'Standard1'),
Cassandra.CfDef('Keyspace1', 'Standard2'),
@@ -154,7 +154,7 @@ class ThriftTester(BaseTester):
Cassandra.CfDef('Keyspace1', 'Super4', column_type='Super',
subcomparator_type='UTF8Type')
])
- keyspace2 = Cassandra.KsDef('Keyspace2',
'org.apache.cassandra.locator.RackUnawareStrategy', 1,
'org.apache.cassandra.locator.EndpointSnitch',
+ keyspace2 = Cassandra.KsDef('Keyspace2',
'org.apache.cassandra.locator.RackUnawareStrategy', 1,
[
Cassandra.CfDef('Keyspace2', 'Standard1'),
Cassandra.CfDef('Keyspace2', 'Standard3'),
@@ -162,12 +162,12 @@ class ThriftTester(BaseTester):
Cassandra.CfDef('Keyspace2', 'Super4', column_type='Super',
subcomparator_type='TimeUUIDType'),
])
- keyspace3 = Cassandra.KsDef('Keyspace3',
'org.apache.cassandra.locator.RackUnawareStrategy', 5,
'org.apache.cassandra.locator.EndpointSnitch',
+ keyspace3 = Cassandra.KsDef('Keyspace3',
'org.apache.cassandra.locator.RackUnawareStrategy', 5,
[
Cassandra.CfDef('Keyspace3', 'Standard1'),
])
- keyspace4 = Cassandra.KsDef('Keyspace4',
'org.apache.cassandra.locator.RackUnawareStrategy', 3,
'org.apache.cassandra.locator.EndpointSnitch',
+ keyspace4 = Cassandra.KsDef('Keyspace4',
'org.apache.cassandra.locator.RackUnawareStrategy', 3,
[
Cassandra.CfDef('Keyspace4', 'Standard1'),
Cassandra.CfDef('Keyspace4', 'Standard3'),
Modified: cassandra/trunk/test/system/test_thrift_server.py
URL:
http://svn.apache.org/viewvc/cassandra/trunk/test/system/test_thrift_server.py?rev=936495&r1=936494&r2=936495&view=diff
==============================================================================
--- cassandra/trunk/test/system/test_thrift_server.py (original)
+++ cassandra/trunk/test/system/test_thrift_server.py Wed Apr 21 20:39:28 2010
@@ -978,10 +978,8 @@ class TestMutations(ThriftTester):
def test_system_keyspace_operations(self):
""" Test keyspace (add, drop, rename) operations """
# create
- keyspace = KsDef('CreateKeyspace',
'org.apache.cassandra.locator.RackUnawareStrategy', 1,
'org.apache.cassandra.locator.EndpointSnitch',
- [
- CfDef('CreateKeyspace', 'CreateKsCf')
- ])
+ keyspace = KsDef('CreateKeyspace',
'org.apache.cassandra.locator.RackUnawareStrategy', 1,
+ [CfDef('CreateKeyspace', 'CreateKsCf')])
client.system_add_keyspace(keyspace)
newks = client.describe_keyspace('CreateKeyspace')
assert 'CreateKsCf' in newks