diff --git a/CHANGES.txt b/CHANGES.txt index 969ea5aa34..e20cf1a894 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -17,11 +17,13 @@ structs such as ColumnPath, ColumnParent, etc. Also normalized thrift struct and argument naming. - Added columnFamily argument to get_key_range. - - Change signature of get_slice and get_slice_super to accept - starting and ending columns as well as an offset. (This allows use - of indexes.) Added "ascending" flag to allow reasonably-efficient - reverse scans as well. Removed get_slice_by_range as redundant. - - Similarly, changed signature of get_slice_super. + - Change signature of get_slice to accept starting and ending + columns as well as an offset. (This allows use of indexes.) + Added "ascending" flag to allow reasonably-efficient reverse + scans as well. Removed get_slice_by_range as redundant. + - Merged _super get methods with the normal ones; return values + are now of ColumnOrSuperColumn. + - Similarly, merged batch_insert_super into batch_insert. - get_key_range operates on one CF at a time - changed `block` boolean on insert methods to ConsistencyLevel enum, with options of NONE, ONE, QUORUM, and ALL. diff --git a/interface/cassandra.thrift b/interface/cassandra.thrift index 14be93d9b8..b3c7b1e0ec 100644 --- a/interface/cassandra.thrift +++ b/interface/cassandra.thrift @@ -32,7 +32,7 @@ namespace perl Cassandra namespace rb CassandraThrift # -# structures +# data structures # struct Column { @@ -41,28 +41,17 @@ struct Column { 3: i64 timestamp, } -typedef map> column_family_map - -struct BatchMutation { - 1: string key, - 2: column_family_map cfmap, -} - struct SuperColumn { 1: binary name, 2: list columns, } -typedef map> SuperColumnFamilyMap - -struct BatchMutationSuper { - 1: string key, - 2: SuperColumnFamilyMap cfmap, +struct ColumnOrSuperColumn { + 1: optional Column column, + 2: optional SuperColumn super_column, } -typedef list> ResultSet - # # Exceptions # @@ -117,9 +106,11 @@ struct SlicePredicate { 2: optional SliceRange slice_range, } -struct ColumnOrSuperColumn { - 1: optional Column column, - 2: optional SuperColumn super_column, +typedef map> column_family_map + +struct BatchMutation { + 1: string key, + 2: column_family_map cfmap, } @@ -142,9 +133,6 @@ service Cassandra { void remove(1:string keyspace, 2:string key, 3:ColumnPath column_path, 4:i64 timestamp, 5:ConsistencyLevel consistency_level=0) throws (1: InvalidRequestException ire, 2: UnavailableException ue), - void batch_insert_super_column(1:string keyspace, 2:BatchMutationSuper batch_mutation_super, 3:ConsistencyLevel consistency_level=0) - throws (1: InvalidRequestException ire, 2: UnavailableException ue), - # range query: returns matching keys list get_key_range(1:string keyspace, 2:string column_family, 3:string start="", 4:string finish="", 5:i32 count=100) throws (1: InvalidRequestException ire), diff --git a/interface/gen-java/org/apache/cassandra/service/BatchMutation.java b/interface/gen-java/org/apache/cassandra/service/BatchMutation.java index f968b14778..edf26e3849 100644 --- a/interface/gen-java/org/apache/cassandra/service/BatchMutation.java +++ b/interface/gen-java/org/apache/cassandra/service/BatchMutation.java @@ -46,7 +46,7 @@ public class BatchMutation implements TBase, java.io.Serializable, Cloneable { public String key; public static final int KEY = 1; - public Map> cfmap; + public Map> cfmap; public static final int CFMAP = 2; private final Isset __isset = new Isset(); @@ -69,7 +69,7 @@ public class BatchMutation implements TBase, java.io.Serializable, Cloneable { public BatchMutation( String key, - Map> cfmap) + Map> cfmap) { this(); this.key = key; @@ -117,11 +117,11 @@ public class BatchMutation implements TBase, java.io.Serializable, Cloneable { } } - public Map> getCfmap() { + public Map> getCfmap() { return this.cfmap; } - public BatchMutation setCfmap(Map> cfmap) { + public BatchMutation setCfmap(Map> cfmap) { this.cfmap = cfmap; return this; } @@ -155,7 +155,7 @@ public class BatchMutation implements TBase, java.io.Serializable, Cloneable { if (value == null) { unsetCfmap(); } else { - setCfmap((Map>)value); + setCfmap((Map>)value); } break; @@ -249,26 +249,26 @@ public class BatchMutation implements TBase, java.io.Serializable, Cloneable { case CFMAP: if (field.type == TType.MAP) { { - TMap _map0 = iprot.readMapBegin(); - this.cfmap = new HashMap>(2*_map0.size); - for (int _i1 = 0; _i1 < _map0.size; ++_i1) + TMap _map8 = iprot.readMapBegin(); + this.cfmap = new HashMap>(2*_map8.size); + for (int _i9 = 0; _i9 < _map8.size; ++_i9) { - String _key2; - List _val3; - _key2 = iprot.readString(); + String _key10; + List _val11; + _key10 = iprot.readString(); { - TList _list4 = iprot.readListBegin(); - _val3 = new ArrayList(_list4.size); - for (int _i5 = 0; _i5 < _list4.size; ++_i5) + TList _list12 = iprot.readListBegin(); + _val11 = new ArrayList(_list12.size); + for (int _i13 = 0; _i13 < _list12.size; ++_i13) { - Column _elem6; - _elem6 = new Column(); - _elem6.read(iprot); - _val3.add(_elem6); + ColumnOrSuperColumn _elem14; + _elem14 = new ColumnOrSuperColumn(); + _elem14.read(iprot); + _val11.add(_elem14); } iprot.readListEnd(); } - this.cfmap.put(_key2, _val3); + this.cfmap.put(_key10, _val11); } iprot.readMapEnd(); } @@ -302,12 +302,12 @@ public class BatchMutation implements TBase, java.io.Serializable, Cloneable { oprot.writeFieldBegin(CFMAP_FIELD_DESC); { oprot.writeMapBegin(new TMap(TType.STRING, TType.LIST, this.cfmap.size())); - for (Map.Entry> _iter7 : this.cfmap.entrySet()) { - oprot.writeString(_iter7.getKey()); + for (Map.Entry> _iter15 : this.cfmap.entrySet()) { + oprot.writeString(_iter15.getKey()); { - oprot.writeListBegin(new TList(TType.STRUCT, _iter7.getValue().size())); - for (Column _iter8 : _iter7.getValue()) { - _iter8.write(oprot); + oprot.writeListBegin(new TList(TType.STRUCT, _iter15.getValue().size())); + for (ColumnOrSuperColumn _iter16 : _iter15.getValue()) { + _iter16.write(oprot); } oprot.writeListEnd(); } diff --git a/interface/gen-java/org/apache/cassandra/service/BatchMutationSuper.java b/interface/gen-java/org/apache/cassandra/service/BatchMutationSuper.java deleted file mode 100644 index 09f70ac61d..0000000000 --- a/interface/gen-java/org/apache/cassandra/service/BatchMutationSuper.java +++ /dev/null @@ -1,353 +0,0 @@ -/** - * Autogenerated by Thrift - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - */ -package org.apache.cassandra.service; -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - - -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.Set; -import java.util.HashSet; -import java.util.Collections; -import org.apache.log4j.Logger; - -import org.apache.thrift.*; -import org.apache.thrift.meta_data.*; -import org.apache.thrift.protocol.*; - -public class BatchMutationSuper implements TBase, java.io.Serializable, Cloneable { - private static final TStruct STRUCT_DESC = new TStruct("BatchMutationSuper"); - private static final TField KEY_FIELD_DESC = new TField("key", TType.STRING, (short)1); - private static final TField CFMAP_FIELD_DESC = new TField("cfmap", TType.MAP, (short)2); - - public String key; - public static final int KEY = 1; - public Map> cfmap; - public static final int CFMAP = 2; - - private final Isset __isset = new Isset(); - private static final class Isset implements java.io.Serializable { - } - - public static final Map metaDataMap = Collections.unmodifiableMap(new HashMap() {{ - put(KEY, new FieldMetaData("key", TFieldRequirementType.DEFAULT, - new FieldValueMetaData(TType.STRING))); - put(CFMAP, new FieldMetaData("cfmap", TFieldRequirementType.DEFAULT, - new FieldValueMetaData(TType.MAP))); - }}); - - static { - FieldMetaData.addStructMetaDataMap(BatchMutationSuper.class, metaDataMap); - } - - public BatchMutationSuper() { - } - - public BatchMutationSuper( - String key, - Map> cfmap) - { - this(); - this.key = key; - this.cfmap = cfmap; - } - - /** - * Performs a deep copy on other. - */ - public BatchMutationSuper(BatchMutationSuper other) { - if (other.isSetKey()) { - this.key = other.key; - } - if (other.isSetCfmap()) { - this.cfmap = other.cfmap; - } - } - - @Override - public BatchMutationSuper clone() { - return new BatchMutationSuper(this); - } - - public String getKey() { - return this.key; - } - - public BatchMutationSuper setKey(String key) { - this.key = key; - return this; - } - - public void unsetKey() { - this.key = null; - } - - // Returns true if field key is set (has been asigned a value) and false otherwise - public boolean isSetKey() { - return this.key != null; - } - - public void setKeyIsSet(boolean value) { - if (!value) { - this.key = null; - } - } - - public Map> getCfmap() { - return this.cfmap; - } - - public BatchMutationSuper setCfmap(Map> cfmap) { - this.cfmap = cfmap; - return this; - } - - public void unsetCfmap() { - this.cfmap = null; - } - - // Returns true if field cfmap is set (has been asigned a value) and false otherwise - public boolean isSetCfmap() { - return this.cfmap != null; - } - - public void setCfmapIsSet(boolean value) { - if (!value) { - this.cfmap = null; - } - } - - public void setFieldValue(int fieldID, Object value) { - switch (fieldID) { - case KEY: - if (value == null) { - unsetKey(); - } else { - setKey((String)value); - } - break; - - case CFMAP: - if (value == null) { - unsetCfmap(); - } else { - setCfmap((Map>)value); - } - break; - - default: - throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!"); - } - } - - public Object getFieldValue(int fieldID) { - switch (fieldID) { - case KEY: - return getKey(); - - case CFMAP: - return getCfmap(); - - default: - throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!"); - } - } - - // Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise - public boolean isSet(int fieldID) { - switch (fieldID) { - case KEY: - return isSetKey(); - case CFMAP: - return isSetCfmap(); - default: - throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!"); - } - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof BatchMutationSuper) - return this.equals((BatchMutationSuper)that); - return false; - } - - public boolean equals(BatchMutationSuper that) { - if (that == null) - return false; - - boolean this_present_key = true && this.isSetKey(); - boolean that_present_key = true && that.isSetKey(); - if (this_present_key || that_present_key) { - if (!(this_present_key && that_present_key)) - return false; - if (!this.key.equals(that.key)) - return false; - } - - boolean this_present_cfmap = true && this.isSetCfmap(); - boolean that_present_cfmap = true && that.isSetCfmap(); - if (this_present_cfmap || that_present_cfmap) { - if (!(this_present_cfmap && that_present_cfmap)) - return false; - if (!this.cfmap.equals(that.cfmap)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - 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 KEY: - if (field.type == TType.STRING) { - this.key = iprot.readString(); - } else { - TProtocolUtil.skip(iprot, field.type); - } - break; - case CFMAP: - if (field.type == TType.MAP) { - { - TMap _map13 = iprot.readMapBegin(); - this.cfmap = new HashMap>(2*_map13.size); - for (int _i14 = 0; _i14 < _map13.size; ++_i14) - { - String _key15; - List _val16; - _key15 = iprot.readString(); - { - TList _list17 = iprot.readListBegin(); - _val16 = new ArrayList(_list17.size); - for (int _i18 = 0; _i18 < _list17.size; ++_i18) - { - SuperColumn _elem19; - _elem19 = new SuperColumn(); - _elem19.read(iprot); - _val16.add(_elem19); - } - iprot.readListEnd(); - } - this.cfmap.put(_key15, _val16); - } - iprot.readMapEnd(); - } - } else { - TProtocolUtil.skip(iprot, field.type); - } - break; - default: - TProtocolUtil.skip(iprot, field.type); - break; - } - 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.key != null) { - oprot.writeFieldBegin(KEY_FIELD_DESC); - oprot.writeString(this.key); - oprot.writeFieldEnd(); - } - if (this.cfmap != null) { - oprot.writeFieldBegin(CFMAP_FIELD_DESC); - { - oprot.writeMapBegin(new TMap(TType.STRING, TType.LIST, this.cfmap.size())); - for (Map.Entry> _iter20 : this.cfmap.entrySet()) { - oprot.writeString(_iter20.getKey()); - { - oprot.writeListBegin(new TList(TType.STRUCT, _iter20.getValue().size())); - for (SuperColumn _iter21 : _iter20.getValue()) { - _iter21.write(oprot); - } - oprot.writeListEnd(); - } - } - oprot.writeMapEnd(); - } - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("BatchMutationSuper("); - boolean first = true; - - sb.append("key:"); - if (this.key == null) { - sb.append("null"); - } else { - sb.append(this.key); - } - first = false; - if (!first) sb.append(", "); - sb.append("cfmap:"); - if (this.cfmap == null) { - sb.append("null"); - } else { - sb.append(this.cfmap); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check that fields of type enum have valid values - } - -} - diff --git a/interface/gen-java/org/apache/cassandra/service/Cassandra.java b/interface/gen-java/org/apache/cassandra/service/Cassandra.java index ee811c8796..1c0aa8a179 100644 --- a/interface/gen-java/org/apache/cassandra/service/Cassandra.java +++ b/interface/gen-java/org/apache/cassandra/service/Cassandra.java @@ -55,8 +55,6 @@ public class Cassandra { public void remove(String keyspace, String key, ColumnPath column_path, long timestamp, int consistency_level) throws InvalidRequestException, UnavailableException, TException; - public void batch_insert_super_column(String keyspace, BatchMutationSuper batch_mutation_super, int consistency_level) throws InvalidRequestException, UnavailableException, TException; - public List get_key_range(String keyspace, String column_family, String start, String finish, int count) throws InvalidRequestException, TException; public String get_string_property(String property) throws TException; @@ -337,44 +335,6 @@ public class Cassandra { return; } - public void batch_insert_super_column(String keyspace, BatchMutationSuper batch_mutation_super, int consistency_level) throws InvalidRequestException, UnavailableException, TException - { - send_batch_insert_super_column(keyspace, batch_mutation_super, consistency_level); - recv_batch_insert_super_column(); - } - - public void send_batch_insert_super_column(String keyspace, BatchMutationSuper batch_mutation_super, int consistency_level) throws TException - { - oprot_.writeMessageBegin(new TMessage("batch_insert_super_column", TMessageType.CALL, seqid_)); - batch_insert_super_column_args args = new batch_insert_super_column_args(); - args.keyspace = keyspace; - args.batch_mutation_super = batch_mutation_super; - args.consistency_level = consistency_level; - args.write(oprot_); - oprot_.writeMessageEnd(); - oprot_.getTransport().flush(); - } - - public void recv_batch_insert_super_column() throws InvalidRequestException, UnavailableException, TException - { - TMessage msg = iprot_.readMessageBegin(); - if (msg.type == TMessageType.EXCEPTION) { - TApplicationException x = TApplicationException.read(iprot_); - iprot_.readMessageEnd(); - throw x; - } - batch_insert_super_column_result result = new batch_insert_super_column_result(); - result.read(iprot_); - iprot_.readMessageEnd(); - if (result.ire != null) { - throw result.ire; - } - if (result.ue != null) { - throw result.ue; - } - return; - } - public List get_key_range(String keyspace, String column_family, String start, String finish, int count) throws InvalidRequestException, TException { send_get_key_range(keyspace, column_family, start, finish, count); @@ -529,7 +489,6 @@ public class Cassandra { processMap_.put("insert", new insert()); processMap_.put("batch_insert", new batch_insert()); processMap_.put("remove", new remove()); - processMap_.put("batch_insert_super_column", new batch_insert_super_column()); processMap_.put("get_key_range", new get_key_range()); processMap_.put("get_string_property", new get_string_property()); processMap_.put("get_string_list_property", new get_string_list_property()); @@ -740,36 +699,6 @@ public class Cassandra { } - private class batch_insert_super_column implements ProcessFunction { - public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException - { - batch_insert_super_column_args args = new batch_insert_super_column_args(); - args.read(iprot); - iprot.readMessageEnd(); - batch_insert_super_column_result result = new batch_insert_super_column_result(); - try { - iface_.batch_insert_super_column(args.keyspace, args.batch_mutation_super, args.consistency_level); - } catch (InvalidRequestException ire) { - result.ire = ire; - } catch (UnavailableException ue) { - result.ue = ue; - } catch (Throwable th) { - LOGGER.error("Internal error processing batch_insert_super_column", th); - TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing batch_insert_super_column"); - oprot.writeMessageBegin(new TMessage("batch_insert_super_column", TMessageType.EXCEPTION, seqid)); - x.write(oprot); - oprot.writeMessageEnd(); - oprot.getTransport().flush(); - return; - } - oprot.writeMessageBegin(new TMessage("batch_insert_super_column", TMessageType.REPLY, seqid)); - result.write(oprot); - oprot.writeMessageEnd(); - oprot.getTransport().flush(); - } - - } - private class get_key_range implements ProcessFunction { public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException { @@ -1650,14 +1579,14 @@ public class Cassandra { case SUCCESS: if (field.type == TType.LIST) { { - TList _list26 = iprot.readListBegin(); - this.success = new ArrayList(_list26.size); - for (int _i27 = 0; _i27 < _list26.size; ++_i27) + TList _list17 = iprot.readListBegin(); + this.success = new ArrayList(_list17.size); + for (int _i18 = 0; _i18 < _list17.size; ++_i18) { - ColumnOrSuperColumn _elem28; - _elem28 = new ColumnOrSuperColumn(); - _elem28.read(iprot); - this.success.add(_elem28); + ColumnOrSuperColumn _elem19; + _elem19 = new ColumnOrSuperColumn(); + _elem19.read(iprot); + this.success.add(_elem19); } iprot.readListEnd(); } @@ -1701,8 +1630,8 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new TList(TType.STRUCT, this.success.size())); - for (ColumnOrSuperColumn _iter29 : this.success) { - _iter29.write(oprot); + for (ColumnOrSuperColumn _iter20 : this.success) { + _iter20.write(oprot); } oprot.writeListEnd(); } @@ -5604,655 +5533,6 @@ public class Cassandra { } - public static class batch_insert_super_column_args implements TBase, java.io.Serializable, Cloneable { - private static final TStruct STRUCT_DESC = new TStruct("batch_insert_super_column_args"); - private static final TField KEYSPACE_FIELD_DESC = new TField("keyspace", TType.STRING, (short)1); - private static final TField BATCH_MUTATION_SUPER_FIELD_DESC = new TField("batch_mutation_super", TType.STRUCT, (short)2); - private static final TField CONSISTENCY_LEVEL_FIELD_DESC = new TField("consistency_level", TType.I32, (short)3); - - public String keyspace; - public static final int KEYSPACE = 1; - public BatchMutationSuper batch_mutation_super; - public static final int BATCH_MUTATION_SUPER = 2; - /** - * - * @see ConsistencyLevel - */ - public int consistency_level; - public static final int CONSISTENCY_LEVEL = 3; - - private final Isset __isset = new Isset(); - private static final class Isset implements java.io.Serializable { - public boolean consistency_level = false; - } - - public static final Map metaDataMap = Collections.unmodifiableMap(new HashMap() {{ - put(KEYSPACE, new FieldMetaData("keyspace", TFieldRequirementType.DEFAULT, - new FieldValueMetaData(TType.STRING))); - put(BATCH_MUTATION_SUPER, new FieldMetaData("batch_mutation_super", TFieldRequirementType.DEFAULT, - new StructMetaData(TType.STRUCT, BatchMutationSuper.class))); - put(CONSISTENCY_LEVEL, new FieldMetaData("consistency_level", TFieldRequirementType.DEFAULT, - new FieldValueMetaData(TType.I32))); - }}); - - static { - FieldMetaData.addStructMetaDataMap(batch_insert_super_column_args.class, metaDataMap); - } - - public batch_insert_super_column_args() { - this.consistency_level = 0; - - } - - public batch_insert_super_column_args( - String keyspace, - BatchMutationSuper batch_mutation_super, - int consistency_level) - { - this(); - this.keyspace = keyspace; - this.batch_mutation_super = batch_mutation_super; - this.consistency_level = consistency_level; - this.__isset.consistency_level = true; - } - - /** - * Performs a deep copy on other. - */ - public batch_insert_super_column_args(batch_insert_super_column_args other) { - if (other.isSetKeyspace()) { - this.keyspace = other.keyspace; - } - if (other.isSetBatch_mutation_super()) { - this.batch_mutation_super = new BatchMutationSuper(other.batch_mutation_super); - } - __isset.consistency_level = other.__isset.consistency_level; - this.consistency_level = other.consistency_level; - } - - @Override - public batch_insert_super_column_args clone() { - return new batch_insert_super_column_args(this); - } - - public String getKeyspace() { - return this.keyspace; - } - - public batch_insert_super_column_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 BatchMutationSuper getBatch_mutation_super() { - return this.batch_mutation_super; - } - - public batch_insert_super_column_args setBatch_mutation_super(BatchMutationSuper batch_mutation_super) { - this.batch_mutation_super = batch_mutation_super; - return this; - } - - public void unsetBatch_mutation_super() { - this.batch_mutation_super = null; - } - - // Returns true if field batch_mutation_super is set (has been asigned a value) and false otherwise - public boolean isSetBatch_mutation_super() { - return this.batch_mutation_super != null; - } - - public void setBatch_mutation_superIsSet(boolean value) { - if (!value) { - this.batch_mutation_super = null; - } - } - - /** - * - * @see ConsistencyLevel - */ - public int getConsistency_level() { - return this.consistency_level; - } - - /** - * - * @see ConsistencyLevel - */ - public batch_insert_super_column_args setConsistency_level(int consistency_level) { - this.consistency_level = consistency_level; - this.__isset.consistency_level = true; - return this; - } - - public void unsetConsistency_level() { - this.__isset.consistency_level = false; - } - - // Returns true if field consistency_level is set (has been asigned a value) and false otherwise - public boolean isSetConsistency_level() { - return this.__isset.consistency_level; - } - - public void setConsistency_levelIsSet(boolean value) { - this.__isset.consistency_level = value; - } - - public void setFieldValue(int fieldID, Object value) { - switch (fieldID) { - case KEYSPACE: - if (value == null) { - unsetKeyspace(); - } else { - setKeyspace((String)value); - } - break; - - case BATCH_MUTATION_SUPER: - if (value == null) { - unsetBatch_mutation_super(); - } else { - setBatch_mutation_super((BatchMutationSuper)value); - } - break; - - case CONSISTENCY_LEVEL: - if (value == null) { - unsetConsistency_level(); - } else { - setConsistency_level((Integer)value); - } - break; - - default: - throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!"); - } - } - - public Object getFieldValue(int fieldID) { - switch (fieldID) { - case KEYSPACE: - return getKeyspace(); - - case BATCH_MUTATION_SUPER: - return getBatch_mutation_super(); - - case CONSISTENCY_LEVEL: - return getConsistency_level(); - - default: - throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!"); - } - } - - // Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise - public boolean isSet(int fieldID) { - switch (fieldID) { - case KEYSPACE: - return isSetKeyspace(); - case BATCH_MUTATION_SUPER: - return isSetBatch_mutation_super(); - case CONSISTENCY_LEVEL: - return isSetConsistency_level(); - default: - throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!"); - } - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof batch_insert_super_column_args) - return this.equals((batch_insert_super_column_args)that); - return false; - } - - public boolean equals(batch_insert_super_column_args that) { - 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_batch_mutation_super = true && this.isSetBatch_mutation_super(); - boolean that_present_batch_mutation_super = true && that.isSetBatch_mutation_super(); - if (this_present_batch_mutation_super || that_present_batch_mutation_super) { - if (!(this_present_batch_mutation_super && that_present_batch_mutation_super)) - return false; - if (!this.batch_mutation_super.equals(that.batch_mutation_super)) - return false; - } - - boolean this_present_consistency_level = true; - boolean that_present_consistency_level = true; - if (this_present_consistency_level || that_present_consistency_level) { - if (!(this_present_consistency_level && that_present_consistency_level)) - return false; - if (this.consistency_level != that.consistency_level) - return false; - } - - return true; - } - - @Override - public int hashCode() { - 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 KEYSPACE: - if (field.type == TType.STRING) { - this.keyspace = iprot.readString(); - } else { - TProtocolUtil.skip(iprot, field.type); - } - break; - case BATCH_MUTATION_SUPER: - if (field.type == TType.STRUCT) { - this.batch_mutation_super = new BatchMutationSuper(); - this.batch_mutation_super.read(iprot); - } else { - TProtocolUtil.skip(iprot, field.type); - } - break; - case CONSISTENCY_LEVEL: - if (field.type == TType.I32) { - this.consistency_level = iprot.readI32(); - this.__isset.consistency_level = true; - } else { - TProtocolUtil.skip(iprot, field.type); - } - break; - default: - TProtocolUtil.skip(iprot, field.type); - break; - } - 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.keyspace != null) { - oprot.writeFieldBegin(KEYSPACE_FIELD_DESC); - oprot.writeString(this.keyspace); - oprot.writeFieldEnd(); - } - if (this.batch_mutation_super != null) { - oprot.writeFieldBegin(BATCH_MUTATION_SUPER_FIELD_DESC); - this.batch_mutation_super.write(oprot); - oprot.writeFieldEnd(); - } - oprot.writeFieldBegin(CONSISTENCY_LEVEL_FIELD_DESC); - oprot.writeI32(this.consistency_level); - oprot.writeFieldEnd(); - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("batch_insert_super_column_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("batch_mutation_super:"); - if (this.batch_mutation_super == null) { - sb.append("null"); - } else { - sb.append(this.batch_mutation_super); - } - first = false; - if (!first) sb.append(", "); - sb.append("consistency_level:"); - String consistency_level_name = ConsistencyLevel.VALUES_TO_NAMES.get(this.consistency_level); - if (consistency_level_name != null) { - sb.append(consistency_level_name); - sb.append(" ("); - } - sb.append(this.consistency_level); - if (consistency_level_name != null) { - sb.append(")"); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check that fields of type enum have valid values - if (isSetConsistency_level() && !ConsistencyLevel.VALID_VALUES.contains(consistency_level)){ - throw new TProtocolException("The field 'consistency_level' has been assigned the invalid value " + consistency_level); - } - } - - } - - public static class batch_insert_super_column_result implements TBase, java.io.Serializable, Cloneable { - private static final TStruct STRUCT_DESC = new TStruct("batch_insert_super_column_result"); - private static final TField IRE_FIELD_DESC = new TField("ire", TType.STRUCT, (short)1); - private static final TField UE_FIELD_DESC = new TField("ue", TType.STRUCT, (short)2); - - public InvalidRequestException ire; - public static final int IRE = 1; - public UnavailableException ue; - public static final int UE = 2; - - private final Isset __isset = new Isset(); - private static final class Isset implements java.io.Serializable { - } - - public static final Map metaDataMap = Collections.unmodifiableMap(new HashMap() {{ - put(IRE, new FieldMetaData("ire", TFieldRequirementType.DEFAULT, - new FieldValueMetaData(TType.STRUCT))); - put(UE, new FieldMetaData("ue", TFieldRequirementType.DEFAULT, - new FieldValueMetaData(TType.STRUCT))); - }}); - - static { - FieldMetaData.addStructMetaDataMap(batch_insert_super_column_result.class, metaDataMap); - } - - public batch_insert_super_column_result() { - } - - public batch_insert_super_column_result( - InvalidRequestException ire, - UnavailableException ue) - { - this(); - this.ire = ire; - this.ue = ue; - } - - /** - * Performs a deep copy on other. - */ - public batch_insert_super_column_result(batch_insert_super_column_result other) { - if (other.isSetIre()) { - this.ire = new InvalidRequestException(other.ire); - } - if (other.isSetUe()) { - this.ue = new UnavailableException(other.ue); - } - } - - @Override - public batch_insert_super_column_result clone() { - return new batch_insert_super_column_result(this); - } - - public InvalidRequestException getIre() { - return this.ire; - } - - public batch_insert_super_column_result setIre(InvalidRequestException ire) { - this.ire = ire; - return this; - } - - public void unsetIre() { - this.ire = null; - } - - // Returns true if field ire is set (has been asigned a value) and false otherwise - public boolean isSetIre() { - return this.ire != null; - } - - public void setIreIsSet(boolean value) { - if (!value) { - this.ire = null; - } - } - - public UnavailableException getUe() { - return this.ue; - } - - public batch_insert_super_column_result setUe(UnavailableException ue) { - this.ue = ue; - return this; - } - - public void unsetUe() { - this.ue = null; - } - - // Returns true if field ue is set (has been asigned a value) and false otherwise - public boolean isSetUe() { - return this.ue != null; - } - - public void setUeIsSet(boolean value) { - if (!value) { - this.ue = null; - } - } - - public void setFieldValue(int fieldID, Object value) { - switch (fieldID) { - case IRE: - if (value == null) { - unsetIre(); - } else { - setIre((InvalidRequestException)value); - } - break; - - case UE: - if (value == null) { - unsetUe(); - } else { - setUe((UnavailableException)value); - } - break; - - default: - throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!"); - } - } - - public Object getFieldValue(int fieldID) { - switch (fieldID) { - case IRE: - return getIre(); - - case UE: - return getUe(); - - default: - throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!"); - } - } - - // Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise - public boolean isSet(int fieldID) { - switch (fieldID) { - case IRE: - return isSetIre(); - case UE: - return isSetUe(); - default: - throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!"); - } - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof batch_insert_super_column_result) - return this.equals((batch_insert_super_column_result)that); - return false; - } - - public boolean equals(batch_insert_super_column_result that) { - if (that == null) - return false; - - boolean this_present_ire = true && this.isSetIre(); - boolean that_present_ire = true && that.isSetIre(); - if (this_present_ire || that_present_ire) { - if (!(this_present_ire && that_present_ire)) - return false; - if (!this.ire.equals(that.ire)) - return false; - } - - boolean this_present_ue = true && this.isSetUe(); - boolean that_present_ue = true && that.isSetUe(); - if (this_present_ue || that_present_ue) { - if (!(this_present_ue && that_present_ue)) - return false; - if (!this.ue.equals(that.ue)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - 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 IRE: - if (field.type == TType.STRUCT) { - this.ire = new InvalidRequestException(); - this.ire.read(iprot); - } else { - TProtocolUtil.skip(iprot, field.type); - } - break; - case UE: - if (field.type == TType.STRUCT) { - this.ue = new UnavailableException(); - this.ue.read(iprot); - } else { - TProtocolUtil.skip(iprot, field.type); - } - break; - default: - TProtocolUtil.skip(iprot, field.type); - break; - } - 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.isSetIre()) { - oprot.writeFieldBegin(IRE_FIELD_DESC); - this.ire.write(oprot); - oprot.writeFieldEnd(); - } else if (this.isSetUe()) { - oprot.writeFieldBegin(UE_FIELD_DESC); - this.ue.write(oprot); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("batch_insert_super_column_result("); - boolean first = true; - - sb.append("ire:"); - if (this.ire == null) { - sb.append("null"); - } else { - sb.append(this.ire); - } - first = false; - if (!first) sb.append(", "); - sb.append("ue:"); - if (this.ue == null) { - sb.append("null"); - } else { - sb.append(this.ue); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws TException { - // check for required fields - // check that fields of type enum have valid values - } - - } - public static class get_key_range_args implements TBase, java.io.Serializable, Cloneable { private static final TStruct STRUCT_DESC = new TStruct("get_key_range_args"); private static final TField KEYSPACE_FIELD_DESC = new TField("keyspace", TType.STRING, (short)1); @@ -6966,13 +6246,13 @@ public class Cassandra { case SUCCESS: if (field.type == TType.LIST) { { - TList _list30 = iprot.readListBegin(); - this.success = new ArrayList(_list30.size); - for (int _i31 = 0; _i31 < _list30.size; ++_i31) + TList _list21 = iprot.readListBegin(); + this.success = new ArrayList(_list21.size); + for (int _i22 = 0; _i22 < _list21.size; ++_i22) { - String _elem32; - _elem32 = iprot.readString(); - this.success.add(_elem32); + String _elem23; + _elem23 = iprot.readString(); + this.success.add(_elem23); } iprot.readListEnd(); } @@ -7008,8 +6288,8 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new TList(TType.STRING, this.success.size())); - for (String _iter33 : this.success) { - oprot.writeString(_iter33); + for (String _iter24 : this.success) { + oprot.writeString(_iter24); } oprot.writeListEnd(); } @@ -7805,13 +7085,13 @@ public class Cassandra { case SUCCESS: if (field.type == TType.LIST) { { - TList _list34 = iprot.readListBegin(); - this.success = new ArrayList(_list34.size); - for (int _i35 = 0; _i35 < _list34.size; ++_i35) + TList _list25 = iprot.readListBegin(); + this.success = new ArrayList(_list25.size); + for (int _i26 = 0; _i26 < _list25.size; ++_i26) { - String _elem36; - _elem36 = iprot.readString(); - this.success.add(_elem36); + String _elem27; + _elem27 = iprot.readString(); + this.success.add(_elem27); } iprot.readListEnd(); } @@ -7839,8 +7119,8 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new TList(TType.STRING, this.success.size())); - for (String _iter37 : this.success) { - oprot.writeString(_iter37); + for (String _iter28 : this.success) { + oprot.writeString(_iter28); } oprot.writeListEnd(); } @@ -8303,27 +7583,27 @@ public class Cassandra { case SUCCESS: if (field.type == TType.MAP) { { - TMap _map38 = iprot.readMapBegin(); - this.success = new HashMap>(2*_map38.size); - for (int _i39 = 0; _i39 < _map38.size; ++_i39) + TMap _map29 = iprot.readMapBegin(); + this.success = new HashMap>(2*_map29.size); + for (int _i30 = 0; _i30 < _map29.size; ++_i30) { - String _key40; - Map _val41; - _key40 = iprot.readString(); + String _key31; + Map _val32; + _key31 = iprot.readString(); { - TMap _map42 = iprot.readMapBegin(); - _val41 = new HashMap(2*_map42.size); - for (int _i43 = 0; _i43 < _map42.size; ++_i43) + TMap _map33 = iprot.readMapBegin(); + _val32 = new HashMap(2*_map33.size); + for (int _i34 = 0; _i34 < _map33.size; ++_i34) { - String _key44; - String _val45; - _key44 = iprot.readString(); - _val45 = iprot.readString(); - _val41.put(_key44, _val45); + String _key35; + String _val36; + _key35 = iprot.readString(); + _val36 = iprot.readString(); + _val32.put(_key35, _val36); } iprot.readMapEnd(); } - this.success.put(_key40, _val41); + this.success.put(_key31, _val32); } iprot.readMapEnd(); } @@ -8359,13 +7639,13 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeMapBegin(new TMap(TType.STRING, TType.MAP, this.success.size())); - for (Map.Entry> _iter46 : this.success.entrySet()) { - oprot.writeString(_iter46.getKey()); + for (Map.Entry> _iter37 : this.success.entrySet()) { + oprot.writeString(_iter37.getKey()); { - oprot.writeMapBegin(new TMap(TType.STRING, TType.STRING, _iter46.getValue().size())); - for (Map.Entry _iter47 : _iter46.getValue().entrySet()) { - oprot.writeString(_iter47.getKey()); - oprot.writeString(_iter47.getValue()); + oprot.writeMapBegin(new TMap(TType.STRING, TType.STRING, _iter37.getValue().size())); + for (Map.Entry _iter38 : _iter37.getValue().entrySet()) { + oprot.writeString(_iter38.getKey()); + oprot.writeString(_iter38.getValue()); } oprot.writeMapEnd(); } diff --git a/interface/gen-java/org/apache/cassandra/service/SlicePredicate.java b/interface/gen-java/org/apache/cassandra/service/SlicePredicate.java index 781aa2b268..a511b676e5 100644 --- a/interface/gen-java/org/apache/cassandra/service/SlicePredicate.java +++ b/interface/gen-java/org/apache/cassandra/service/SlicePredicate.java @@ -249,13 +249,13 @@ public class SlicePredicate implements TBase, java.io.Serializable, Cloneable { case COLUMN_NAMES: if (field.type == TType.LIST) { { - TList _list22 = iprot.readListBegin(); - this.column_names = new ArrayList(_list22.size); - for (int _i23 = 0; _i23 < _list22.size; ++_i23) + TList _list4 = iprot.readListBegin(); + this.column_names = new ArrayList(_list4.size); + for (int _i5 = 0; _i5 < _list4.size; ++_i5) { - byte[] _elem24; - _elem24 = iprot.readBinary(); - this.column_names.add(_elem24); + byte[] _elem6; + _elem6 = iprot.readBinary(); + this.column_names.add(_elem6); } iprot.readListEnd(); } @@ -293,8 +293,8 @@ public class SlicePredicate implements TBase, java.io.Serializable, Cloneable { oprot.writeFieldBegin(COLUMN_NAMES_FIELD_DESC); { oprot.writeListBegin(new TList(TType.STRING, this.column_names.size())); - for (byte[] _iter25 : this.column_names) { - oprot.writeBinary(_iter25); + for (byte[] _iter7 : this.column_names) { + oprot.writeBinary(_iter7); } oprot.writeListEnd(); } diff --git a/interface/gen-java/org/apache/cassandra/service/SuperColumn.java b/interface/gen-java/org/apache/cassandra/service/SuperColumn.java index 812ad439d0..e28cc43d6d 100644 --- a/interface/gen-java/org/apache/cassandra/service/SuperColumn.java +++ b/interface/gen-java/org/apache/cassandra/service/SuperColumn.java @@ -255,14 +255,14 @@ public class SuperColumn implements TBase, java.io.Serializable, Cloneable { case COLUMNS: if (field.type == TType.LIST) { { - TList _list9 = iprot.readListBegin(); - this.columns = new ArrayList(_list9.size); - for (int _i10 = 0; _i10 < _list9.size; ++_i10) + TList _list0 = iprot.readListBegin(); + this.columns = new ArrayList(_list0.size); + for (int _i1 = 0; _i1 < _list0.size; ++_i1) { - Column _elem11; - _elem11 = new Column(); - _elem11.read(iprot); - this.columns.add(_elem11); + Column _elem2; + _elem2 = new Column(); + _elem2.read(iprot); + this.columns.add(_elem2); } iprot.readListEnd(); } @@ -296,8 +296,8 @@ public class SuperColumn implements TBase, java.io.Serializable, Cloneable { oprot.writeFieldBegin(COLUMNS_FIELD_DESC); { oprot.writeListBegin(new TList(TType.STRUCT, this.columns.size())); - for (Column _iter12 : this.columns) { - _iter12.write(oprot); + for (Column _iter3 : this.columns) { + _iter3.write(oprot); } oprot.writeListEnd(); } diff --git a/src/java/org/apache/cassandra/db/RowMutation.java b/src/java/org/apache/cassandra/db/RowMutation.java index ce46284a79..466e1368f7 100644 --- a/src/java/org/apache/cassandra/db/RowMutation.java +++ b/src/java/org/apache/cassandra/db/RowMutation.java @@ -37,10 +37,7 @@ import org.apache.commons.lang.StringUtils; import org.apache.cassandra.io.ICompactSerializer; import org.apache.cassandra.net.EndPoint; import org.apache.cassandra.net.Message; -import org.apache.cassandra.service.StorageService; -import org.apache.cassandra.service.BatchMutationSuper; -import org.apache.cassandra.service.BatchMutation; -import org.apache.cassandra.service.InvalidRequestException; +import org.apache.cassandra.service.*; import org.apache.cassandra.utils.FBUtilities; import org.apache.cassandra.db.filter.QueryPath; import org.apache.cassandra.db.marshal.MarshalException; @@ -243,35 +240,24 @@ public class RowMutation implements Serializable public static RowMutation getRowMutation(String table, BatchMutation batchMutation) { RowMutation rm = new RowMutation(table, batchMutation.key.trim()); - for (String cfname : batchMutation.cfmap.keySet()) + for (Map.Entry> entry : batchMutation.cfmap.entrySet()) { - List list = batchMutation.cfmap.get(cfname); - for (org.apache.cassandra.service.Column column : list) + String cfName = entry.getKey(); + for (ColumnOrSuperColumn cosc : entry.getValue()) { - rm.add(new QueryPath(cfname, null, column.name), column.value, column.timestamp); - } - } - return rm; - } - - public static RowMutation getRowMutation(String table, BatchMutationSuper batchMutationSuper) throws InvalidRequestException - { - RowMutation rm = new RowMutation(table, batchMutationSuper.key.trim()); - for (String cfName : batchMutationSuper.cfmap.keySet()) - { - for (org.apache.cassandra.service.SuperColumn super_column : batchMutationSuper.cfmap.get(cfName)) - { - for (org.apache.cassandra.service.Column column : super_column.columns) + if (cosc.column == null) { - try + assert cosc.super_column != null; + for (org.apache.cassandra.service.Column column : cosc.super_column.columns) { - rm.add(new QueryPath(cfName, super_column.name, column.name), column.value, column.timestamp); - } - catch (MarshalException e) - { - throw new InvalidRequestException(e.getMessage()); + rm.add(new QueryPath(cfName, cosc.super_column.name, column.name), column.value, column.timestamp); } } + else + { + assert cosc.super_column == null; + rm.add(new QueryPath(cfName, null, cosc.column.name), cosc.column.value, cosc.column.timestamp); + } } } return rm; diff --git a/src/java/org/apache/cassandra/service/CassandraServer.java b/src/java/org/apache/cassandra/service/CassandraServer.java index 991b7af989..59e9c756bc 100644 --- a/src/java/org/apache/cassandra/service/CassandraServer.java +++ b/src/java/org/apache/cassandra/service/CassandraServer.java @@ -327,9 +327,19 @@ public class CassandraServer implements Cassandra.Iface for (String cfName : batch_mutation.cfmap.keySet()) { - for (Column c : batch_mutation.cfmap.get(cfName)) + for (ColumnOrSuperColumn cosc : batch_mutation.cfmap.get(cfName)) { - ThriftValidation.validateColumnPath(table, new ColumnPath(cfName, null, c.name)); + if (cosc.column != null) + { + ThriftValidation.validateColumnPath(table, new ColumnPath(cfName, null, cosc.column.name)); + } + if (cosc.super_column != null) + { + for (Column c : cosc.super_column.columns) + { + ThriftValidation.validateColumnPath(table, new ColumnPath(cfName, cosc.super_column.name, c.name)); + } + } } } @@ -361,26 +371,6 @@ public class CassandraServer implements Cassandra.Iface } } - public void batch_insert_super_column(String table, BatchMutationSuper batch_mutation_super, int consistency_level) - throws InvalidRequestException, UnavailableException - { - if (logger.isDebugEnabled()) - logger.debug("batch_insert_SuperColumn"); - - for (String cfName : batch_mutation_super.cfmap.keySet()) - { - for (SuperColumn sc : batch_mutation_super.cfmap.get(cfName)) - { - for (Column c : sc.columns) - { - ThriftValidation.validateColumnPath(table, new ColumnPath(cfName, sc.name, c.name)); - } - } - } - - doInsert(consistency_level, RowMutation.getRowMutation(table, batch_mutation_super)); - } - public String get_string_property(String propertyName) { if (propertyName.equals("cluster name")) diff --git a/test/system/test_server.py b/test/system/test_server.py index 77573ff79b..a6ddd577cb 100644 --- a/test/system/test_server.py +++ b/test/system/test_server.py @@ -43,8 +43,8 @@ def _insert_simple(block=True): client.insert('Keyspace1', 'key1', ColumnPath('Standard1', column='c2'), 'value2', 0, consistencyLevel) def _insert_batch(block): - cfmap = {'Standard1': _SIMPLE_COLUMNS, - 'Standard2': _SIMPLE_COLUMNS} + cfmap = {'Standard1': [ColumnOrSuperColumn(c) for c in _SIMPLE_COLUMNS], + 'Standard2': [ColumnOrSuperColumn(c) for c in _SIMPLE_COLUMNS]} if block: consistencyLevel = ConsistencyLevel.ONE else: @@ -296,17 +296,17 @@ class TestMutations(CassandraTester): InvalidRequestException) def test_batch_insert_super(self): - cfmap = {'Super1': _SUPER_COLUMNS, - 'Super2': _SUPER_COLUMNS} - client.batch_insert_super_column('Keyspace1', BatchMutation(key='key1', cfmap=cfmap), ConsistencyLevel.ZERO) + cfmap = {'Super1': [ColumnOrSuperColumn(super_column=c) for c in _SUPER_COLUMNS], + 'Super2': [ColumnOrSuperColumn(super_column=c) for c in _SUPER_COLUMNS]} + client.batch_insert('Keyspace1', BatchMutation(key='key1', cfmap=cfmap), ConsistencyLevel.ZERO) time.sleep(0.1) _verify_super('Super1') _verify_super('Super2') def test_batch_insert_super_blocking(self): - cfmap = {'Super1': _SUPER_COLUMNS, - 'Super2': _SUPER_COLUMNS} - client.batch_insert_super_column('Keyspace1', BatchMutation(key='key1', cfmap=cfmap), ConsistencyLevel.ONE) + cfmap = {'Super1': [ColumnOrSuperColumn(super_column=c) for c in _SUPER_COLUMNS], + 'Super2': [ColumnOrSuperColumn(super_column=c) for c in _SUPER_COLUMNS]} + client.batch_insert('Keyspace1', BatchMutation(key='key1', cfmap=cfmap), ConsistencyLevel.ONE) _verify_super('Super1') _verify_super('Super2')