diff --git a/CHANGES.txt b/CHANGES.txt index 9f1aa1dbf8..22abcf6c96 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,5 +1,6 @@ 2.0.0-rc1 * fix potential spurious wakeup in AsyncOneResponse (CASSANDRA-5690) + * fix schema-related trigger issues (CASSANDRA-5774) 2.0.0-beta2 diff --git a/interface/cassandra.thrift b/interface/cassandra.thrift index 8a62aea33b..e3d3374b33 100644 --- a/interface/cassandra.thrift +++ b/interface/cassandra.thrift @@ -430,6 +430,15 @@ struct ColumnDef { 5: optional map index_options } +/** + Describes a trigger. + `options` should include at least 'class' param. + Other options are not supported yet. +*/ +struct TriggerDef { + 1: required string name, + 2: required map options +} /* describes a column family. */ struct CfDef { @@ -460,7 +469,7 @@ struct CfDef { 40: optional i32 default_time_to_live, 41: optional i32 index_interval, 42: optional string speculative_retry="NONE", - 43: optional map> triggers, + 43: optional list triggers, /* All of the following are now ignored and unsupplied. */ diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/AuthenticationRequest.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/AuthenticationRequest.java index 5697987b84..3f7f024261 100644 --- a/interface/thrift/gen-java/org/apache/cassandra/thrift/AuthenticationRequest.java +++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/AuthenticationRequest.java @@ -383,7 +383,7 @@ public class AuthenticationRequest implements org.apache.thrift.TBase(2*_map80.size); for (int _i81 = 0; _i81 < _map80.size; ++_i81) { - String _key82; // required + String _key82; // optional String _val83; // required _key82 = iprot.readString(); _val83 = iprot.readString(); @@ -459,7 +459,7 @@ public class AuthenticationRequest implements org.apache.thrift.TBase(2*_map86.size); for (int _i87 = 0; _i87 < _map86.size; ++_i87) { - String _key88; // required + String _key88; // optional String _val89; // required _key88 = iprot.readString(); _val89 = iprot.readString(); 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 7cb5bc8bef..0460bd7667 100644 --- a/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java +++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java @@ -8693,14 +8693,14 @@ public class Cassandra { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list218 = iprot.readListBegin(); - struct.success = new ArrayList(_list218.size); - for (int _i219 = 0; _i219 < _list218.size; ++_i219) + org.apache.thrift.protocol.TList _list216 = iprot.readListBegin(); + struct.success = new ArrayList(_list216.size); + for (int _i217 = 0; _i217 < _list216.size; ++_i217) { - ColumnOrSuperColumn _elem220; // required - _elem220 = new ColumnOrSuperColumn(); - _elem220.read(iprot); - struct.success.add(_elem220); + ColumnOrSuperColumn _elem218; // required + _elem218 = new ColumnOrSuperColumn(); + _elem218.read(iprot); + struct.success.add(_elem218); } iprot.readListEnd(); } @@ -8755,9 +8755,9 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (ColumnOrSuperColumn _iter221 : struct.success) + for (ColumnOrSuperColumn _iter219 : struct.success) { - _iter221.write(oprot); + _iter219.write(oprot); } oprot.writeListEnd(); } @@ -8812,9 +8812,9 @@ public class Cassandra { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (ColumnOrSuperColumn _iter222 : struct.success) + for (ColumnOrSuperColumn _iter220 : struct.success) { - _iter222.write(oprot); + _iter220.write(oprot); } } } @@ -8835,14 +8835,14 @@ public class Cassandra { BitSet incoming = iprot.readBitSet(4); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list223 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList(_list223.size); - for (int _i224 = 0; _i224 < _list223.size; ++_i224) + org.apache.thrift.protocol.TList _list221 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList(_list221.size); + for (int _i222 = 0; _i222 < _list221.size; ++_i222) { - ColumnOrSuperColumn _elem225; // required - _elem225 = new ColumnOrSuperColumn(); - _elem225.read(iprot); - struct.success.add(_elem225); + ColumnOrSuperColumn _elem223; // required + _elem223 = new ColumnOrSuperColumn(); + _elem223.read(iprot); + struct.success.add(_elem223); } } struct.setSuccessIsSet(true); @@ -10847,13 +10847,13 @@ public class Cassandra { case 1: // KEYS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list226 = iprot.readListBegin(); - struct.keys = new ArrayList(_list226.size); - for (int _i227 = 0; _i227 < _list226.size; ++_i227) + org.apache.thrift.protocol.TList _list224 = iprot.readListBegin(); + struct.keys = new ArrayList(_list224.size); + for (int _i225 = 0; _i225 < _list224.size; ++_i225) { - ByteBuffer _elem228; // required - _elem228 = iprot.readBinary(); - struct.keys.add(_elem228); + ByteBuffer _elem226; // required + _elem226 = iprot.readBinary(); + struct.keys.add(_elem226); } iprot.readListEnd(); } @@ -10907,9 +10907,9 @@ public class Cassandra { oprot.writeFieldBegin(KEYS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.keys.size())); - for (ByteBuffer _iter229 : struct.keys) + for (ByteBuffer _iter227 : struct.keys) { - oprot.writeBinary(_iter229); + oprot.writeBinary(_iter227); } oprot.writeListEnd(); } @@ -10949,9 +10949,9 @@ public class Cassandra { TTupleProtocol oprot = (TTupleProtocol) prot; { oprot.writeI32(struct.keys.size()); - for (ByteBuffer _iter230 : struct.keys) + for (ByteBuffer _iter228 : struct.keys) { - oprot.writeBinary(_iter230); + oprot.writeBinary(_iter228); } } struct.column_parent.write(oprot); @@ -10963,13 +10963,13 @@ public class Cassandra { public void read(org.apache.thrift.protocol.TProtocol prot, multiget_slice_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; { - org.apache.thrift.protocol.TList _list231 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.keys = new ArrayList(_list231.size); - for (int _i232 = 0; _i232 < _list231.size; ++_i232) + org.apache.thrift.protocol.TList _list229 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.keys = new ArrayList(_list229.size); + for (int _i230 = 0; _i230 < _list229.size; ++_i230) { - ByteBuffer _elem233; // required - _elem233 = iprot.readBinary(); - struct.keys.add(_elem233); + ByteBuffer _elem231; // required + _elem231 = iprot.readBinary(); + struct.keys.add(_elem231); } } struct.setKeysIsSet(true); @@ -11558,26 +11558,26 @@ public class Cassandra { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map234 = iprot.readMapBegin(); - struct.success = new HashMap>(2*_map234.size); - for (int _i235 = 0; _i235 < _map234.size; ++_i235) + org.apache.thrift.protocol.TMap _map232 = iprot.readMapBegin(); + struct.success = new HashMap>(2*_map232.size); + for (int _i233 = 0; _i233 < _map232.size; ++_i233) { - ByteBuffer _key236; // required - List _val237; // required - _key236 = iprot.readBinary(); + ByteBuffer _key234; // optional + List _val235; // required + _key234 = iprot.readBinary(); { - org.apache.thrift.protocol.TList _list238 = iprot.readListBegin(); - _val237 = new ArrayList(_list238.size); - for (int _i239 = 0; _i239 < _list238.size; ++_i239) + org.apache.thrift.protocol.TList _list236 = iprot.readListBegin(); + _val235 = new ArrayList(_list236.size); + for (int _i237 = 0; _i237 < _list236.size; ++_i237) { - ColumnOrSuperColumn _elem240; // required - _elem240 = new ColumnOrSuperColumn(); - _elem240.read(iprot); - _val237.add(_elem240); + ColumnOrSuperColumn _elem238; // required + _elem238 = new ColumnOrSuperColumn(); + _elem238.read(iprot); + _val235.add(_elem238); } iprot.readListEnd(); } - struct.success.put(_key236, _val237); + struct.success.put(_key234, _val235); } iprot.readMapEnd(); } @@ -11632,14 +11632,14 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, struct.success.size())); - for (Map.Entry> _iter241 : struct.success.entrySet()) + for (Map.Entry> _iter239 : struct.success.entrySet()) { - oprot.writeBinary(_iter241.getKey()); + oprot.writeBinary(_iter239.getKey()); { - oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, _iter241.getValue().size())); - for (ColumnOrSuperColumn _iter242 : _iter241.getValue()) + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, _iter239.getValue().size())); + for (ColumnOrSuperColumn _iter240 : _iter239.getValue()) { - _iter242.write(oprot); + _iter240.write(oprot); } oprot.writeListEnd(); } @@ -11697,14 +11697,14 @@ public class Cassandra { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Map.Entry> _iter243 : struct.success.entrySet()) + for (Map.Entry> _iter241 : struct.success.entrySet()) { - oprot.writeBinary(_iter243.getKey()); + oprot.writeBinary(_iter241.getKey()); { - oprot.writeI32(_iter243.getValue().size()); - for (ColumnOrSuperColumn _iter244 : _iter243.getValue()) + oprot.writeI32(_iter241.getValue().size()); + for (ColumnOrSuperColumn _iter242 : _iter241.getValue()) { - _iter244.write(oprot); + _iter242.write(oprot); } } } @@ -11727,25 +11727,25 @@ public class Cassandra { BitSet incoming = iprot.readBitSet(4); if (incoming.get(0)) { { - org.apache.thrift.protocol.TMap _map245 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, iprot.readI32()); - struct.success = new HashMap>(2*_map245.size); - for (int _i246 = 0; _i246 < _map245.size; ++_i246) + org.apache.thrift.protocol.TMap _map243 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, iprot.readI32()); + struct.success = new HashMap>(2*_map243.size); + for (int _i244 = 0; _i244 < _map243.size; ++_i244) { - ByteBuffer _key247; // required - List _val248; // required - _key247 = iprot.readBinary(); + ByteBuffer _key245; // optional + List _val246; // required + _key245 = iprot.readBinary(); { - org.apache.thrift.protocol.TList _list249 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - _val248 = new ArrayList(_list249.size); - for (int _i250 = 0; _i250 < _list249.size; ++_i250) + org.apache.thrift.protocol.TList _list247 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + _val246 = new ArrayList(_list247.size); + for (int _i248 = 0; _i248 < _list247.size; ++_i248) { - ColumnOrSuperColumn _elem251; // required - _elem251 = new ColumnOrSuperColumn(); - _elem251.read(iprot); - _val248.add(_elem251); + ColumnOrSuperColumn _elem249; // required + _elem249 = new ColumnOrSuperColumn(); + _elem249.read(iprot); + _val246.add(_elem249); } } - struct.success.put(_key247, _val248); + struct.success.put(_key245, _val246); } } struct.setSuccessIsSet(true); @@ -12371,13 +12371,13 @@ public class Cassandra { case 1: // KEYS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list252 = iprot.readListBegin(); - struct.keys = new ArrayList(_list252.size); - for (int _i253 = 0; _i253 < _list252.size; ++_i253) + org.apache.thrift.protocol.TList _list250 = iprot.readListBegin(); + struct.keys = new ArrayList(_list250.size); + for (int _i251 = 0; _i251 < _list250.size; ++_i251) { - ByteBuffer _elem254; // required - _elem254 = iprot.readBinary(); - struct.keys.add(_elem254); + ByteBuffer _elem252; // required + _elem252 = iprot.readBinary(); + struct.keys.add(_elem252); } iprot.readListEnd(); } @@ -12431,9 +12431,9 @@ public class Cassandra { oprot.writeFieldBegin(KEYS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.keys.size())); - for (ByteBuffer _iter255 : struct.keys) + for (ByteBuffer _iter253 : struct.keys) { - oprot.writeBinary(_iter255); + oprot.writeBinary(_iter253); } oprot.writeListEnd(); } @@ -12473,9 +12473,9 @@ public class Cassandra { TTupleProtocol oprot = (TTupleProtocol) prot; { oprot.writeI32(struct.keys.size()); - for (ByteBuffer _iter256 : struct.keys) + for (ByteBuffer _iter254 : struct.keys) { - oprot.writeBinary(_iter256); + oprot.writeBinary(_iter254); } } struct.column_parent.write(oprot); @@ -12487,13 +12487,13 @@ public class Cassandra { public void read(org.apache.thrift.protocol.TProtocol prot, multiget_count_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; { - org.apache.thrift.protocol.TList _list257 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.keys = new ArrayList(_list257.size); - for (int _i258 = 0; _i258 < _list257.size; ++_i258) + org.apache.thrift.protocol.TList _list255 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.keys = new ArrayList(_list255.size); + for (int _i256 = 0; _i256 < _list255.size; ++_i256) { - ByteBuffer _elem259; // required - _elem259 = iprot.readBinary(); - struct.keys.add(_elem259); + ByteBuffer _elem257; // required + _elem257 = iprot.readBinary(); + struct.keys.add(_elem257); } } struct.setKeysIsSet(true); @@ -13078,15 +13078,15 @@ public class Cassandra { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map260 = iprot.readMapBegin(); - struct.success = new HashMap(2*_map260.size); - for (int _i261 = 0; _i261 < _map260.size; ++_i261) + org.apache.thrift.protocol.TMap _map258 = iprot.readMapBegin(); + struct.success = new HashMap(2*_map258.size); + for (int _i259 = 0; _i259 < _map258.size; ++_i259) { - ByteBuffer _key262; // required - int _val263; // required - _key262 = iprot.readBinary(); - _val263 = iprot.readI32(); - struct.success.put(_key262, _val263); + ByteBuffer _key260; // optional + int _val261; // required + _key260 = iprot.readBinary(); + _val261 = iprot.readI32(); + struct.success.put(_key260, _val261); } iprot.readMapEnd(); } @@ -13141,10 +13141,10 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.I32, struct.success.size())); - for (Map.Entry _iter264 : struct.success.entrySet()) + for (Map.Entry _iter262 : struct.success.entrySet()) { - oprot.writeBinary(_iter264.getKey()); - oprot.writeI32(_iter264.getValue()); + oprot.writeBinary(_iter262.getKey()); + oprot.writeI32(_iter262.getValue()); } oprot.writeMapEnd(); } @@ -13199,10 +13199,10 @@ public class Cassandra { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Map.Entry _iter265 : struct.success.entrySet()) + for (Map.Entry _iter263 : struct.success.entrySet()) { - oprot.writeBinary(_iter265.getKey()); - oprot.writeI32(_iter265.getValue()); + oprot.writeBinary(_iter263.getKey()); + oprot.writeI32(_iter263.getValue()); } } } @@ -13223,15 +13223,15 @@ public class Cassandra { BitSet incoming = iprot.readBitSet(4); if (incoming.get(0)) { { - org.apache.thrift.protocol.TMap _map266 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.I32, iprot.readI32()); - struct.success = new HashMap(2*_map266.size); - for (int _i267 = 0; _i267 < _map266.size; ++_i267) + org.apache.thrift.protocol.TMap _map264 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.I32, iprot.readI32()); + struct.success = new HashMap(2*_map264.size); + for (int _i265 = 0; _i265 < _map264.size; ++_i265) { - ByteBuffer _key268; // required - int _val269; // required - _key268 = iprot.readBinary(); - _val269 = iprot.readI32(); - struct.success.put(_key268, _val269); + ByteBuffer _key266; // optional + int _val267; // required + _key266 = iprot.readBinary(); + _val267 = iprot.readI32(); + struct.success.put(_key266, _val267); } } struct.setSuccessIsSet(true); @@ -14509,14 +14509,14 @@ public class Cassandra { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list270 = iprot.readListBegin(); - struct.success = new ArrayList(_list270.size); - for (int _i271 = 0; _i271 < _list270.size; ++_i271) + org.apache.thrift.protocol.TList _list268 = iprot.readListBegin(); + struct.success = new ArrayList(_list268.size); + for (int _i269 = 0; _i269 < _list268.size; ++_i269) { - KeySlice _elem272; // required - _elem272 = new KeySlice(); - _elem272.read(iprot); - struct.success.add(_elem272); + KeySlice _elem270; // required + _elem270 = new KeySlice(); + _elem270.read(iprot); + struct.success.add(_elem270); } iprot.readListEnd(); } @@ -14571,9 +14571,9 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (KeySlice _iter273 : struct.success) + for (KeySlice _iter271 : struct.success) { - _iter273.write(oprot); + _iter271.write(oprot); } oprot.writeListEnd(); } @@ -14628,9 +14628,9 @@ public class Cassandra { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (KeySlice _iter274 : struct.success) + for (KeySlice _iter272 : struct.success) { - _iter274.write(oprot); + _iter272.write(oprot); } } } @@ -14651,14 +14651,14 @@ public class Cassandra { BitSet incoming = iprot.readBitSet(4); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list275 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList(_list275.size); - for (int _i276 = 0; _i276 < _list275.size; ++_i276) + org.apache.thrift.protocol.TList _list273 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList(_list273.size); + for (int _i274 = 0; _i274 < _list273.size; ++_i274) { - KeySlice _elem277; // required - _elem277 = new KeySlice(); - _elem277.read(iprot); - struct.success.add(_elem277); + KeySlice _elem275; // required + _elem275 = new KeySlice(); + _elem275.read(iprot); + struct.success.add(_elem275); } } struct.setSuccessIsSet(true); @@ -15937,14 +15937,14 @@ public class Cassandra { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list278 = iprot.readListBegin(); - struct.success = new ArrayList(_list278.size); - for (int _i279 = 0; _i279 < _list278.size; ++_i279) + org.apache.thrift.protocol.TList _list276 = iprot.readListBegin(); + struct.success = new ArrayList(_list276.size); + for (int _i277 = 0; _i277 < _list276.size; ++_i277) { - KeySlice _elem280; // required - _elem280 = new KeySlice(); - _elem280.read(iprot); - struct.success.add(_elem280); + KeySlice _elem278; // required + _elem278 = new KeySlice(); + _elem278.read(iprot); + struct.success.add(_elem278); } iprot.readListEnd(); } @@ -15999,9 +15999,9 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (KeySlice _iter281 : struct.success) + for (KeySlice _iter279 : struct.success) { - _iter281.write(oprot); + _iter279.write(oprot); } oprot.writeListEnd(); } @@ -16056,9 +16056,9 @@ public class Cassandra { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (KeySlice _iter282 : struct.success) + for (KeySlice _iter280 : struct.success) { - _iter282.write(oprot); + _iter280.write(oprot); } } } @@ -16079,14 +16079,14 @@ public class Cassandra { BitSet incoming = iprot.readBitSet(4); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list283 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList(_list283.size); - for (int _i284 = 0; _i284 < _list283.size; ++_i284) + org.apache.thrift.protocol.TList _list281 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList(_list281.size); + for (int _i282 = 0; _i282 < _list281.size; ++_i282) { - KeySlice _elem285; // required - _elem285 = new KeySlice(); - _elem285.read(iprot); - struct.success.add(_elem285); + KeySlice _elem283; // required + _elem283 = new KeySlice(); + _elem283.read(iprot); + struct.success.add(_elem283); } } struct.setSuccessIsSet(true); @@ -17364,14 +17364,14 @@ public class Cassandra { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list286 = iprot.readListBegin(); - struct.success = new ArrayList(_list286.size); - for (int _i287 = 0; _i287 < _list286.size; ++_i287) + org.apache.thrift.protocol.TList _list284 = iprot.readListBegin(); + struct.success = new ArrayList(_list284.size); + for (int _i285 = 0; _i285 < _list284.size; ++_i285) { - KeySlice _elem288; // required - _elem288 = new KeySlice(); - _elem288.read(iprot); - struct.success.add(_elem288); + KeySlice _elem286; // required + _elem286 = new KeySlice(); + _elem286.read(iprot); + struct.success.add(_elem286); } iprot.readListEnd(); } @@ -17426,9 +17426,9 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (KeySlice _iter289 : struct.success) + for (KeySlice _iter287 : struct.success) { - _iter289.write(oprot); + _iter287.write(oprot); } oprot.writeListEnd(); } @@ -17483,9 +17483,9 @@ public class Cassandra { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (KeySlice _iter290 : struct.success) + for (KeySlice _iter288 : struct.success) { - _iter290.write(oprot); + _iter288.write(oprot); } } } @@ -17506,14 +17506,14 @@ public class Cassandra { BitSet incoming = iprot.readBitSet(4); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list291 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList(_list291.size); - for (int _i292 = 0; _i292 < _list291.size; ++_i292) + org.apache.thrift.protocol.TList _list289 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList(_list289.size); + for (int _i290 = 0; _i290 < _list289.size; ++_i290) { - KeySlice _elem293; // required - _elem293 = new KeySlice(); - _elem293.read(iprot); - struct.success.add(_elem293); + KeySlice _elem291; // required + _elem291 = new KeySlice(); + _elem291.read(iprot); + struct.success.add(_elem291); } } struct.setSuccessIsSet(true); @@ -20805,14 +20805,14 @@ public class Cassandra { case 3: // EXPECTED if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list294 = iprot.readListBegin(); - struct.expected = new ArrayList(_list294.size); - for (int _i295 = 0; _i295 < _list294.size; ++_i295) + org.apache.thrift.protocol.TList _list292 = iprot.readListBegin(); + struct.expected = new ArrayList(_list292.size); + for (int _i293 = 0; _i293 < _list292.size; ++_i293) { - Column _elem296; // required - _elem296 = new Column(); - _elem296.read(iprot); - struct.expected.add(_elem296); + Column _elem294; // required + _elem294 = new Column(); + _elem294.read(iprot); + struct.expected.add(_elem294); } iprot.readListEnd(); } @@ -20824,14 +20824,14 @@ public class Cassandra { case 4: // UPDATES if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list297 = iprot.readListBegin(); - struct.updates = new ArrayList(_list297.size); - for (int _i298 = 0; _i298 < _list297.size; ++_i298) + org.apache.thrift.protocol.TList _list295 = iprot.readListBegin(); + struct.updates = new ArrayList(_list295.size); + for (int _i296 = 0; _i296 < _list295.size; ++_i296) { - Column _elem299; // required - _elem299 = new Column(); - _elem299.read(iprot); - struct.updates.add(_elem299); + Column _elem297; // required + _elem297 = new Column(); + _elem297.read(iprot); + struct.updates.add(_elem297); } iprot.readListEnd(); } @@ -20877,9 +20877,9 @@ public class Cassandra { oprot.writeFieldBegin(EXPECTED_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.expected.size())); - for (Column _iter300 : struct.expected) + for (Column _iter298 : struct.expected) { - _iter300.write(oprot); + _iter298.write(oprot); } oprot.writeListEnd(); } @@ -20889,9 +20889,9 @@ public class Cassandra { oprot.writeFieldBegin(UPDATES_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.updates.size())); - for (Column _iter301 : struct.updates) + for (Column _iter299 : struct.updates) { - _iter301.write(oprot); + _iter299.write(oprot); } oprot.writeListEnd(); } @@ -20933,18 +20933,18 @@ public class Cassandra { if (struct.isSetExpected()) { { oprot.writeI32(struct.expected.size()); - for (Column _iter302 : struct.expected) + for (Column _iter300 : struct.expected) { - _iter302.write(oprot); + _iter300.write(oprot); } } } if (struct.isSetUpdates()) { { oprot.writeI32(struct.updates.size()); - for (Column _iter303 : struct.updates) + for (Column _iter301 : struct.updates) { - _iter303.write(oprot); + _iter301.write(oprot); } } } @@ -20962,28 +20962,28 @@ public class Cassandra { BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list304 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.expected = new ArrayList(_list304.size); - for (int _i305 = 0; _i305 < _list304.size; ++_i305) + org.apache.thrift.protocol.TList _list302 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.expected = new ArrayList(_list302.size); + for (int _i303 = 0; _i303 < _list302.size; ++_i303) { - Column _elem306; // required - _elem306 = new Column(); - _elem306.read(iprot); - struct.expected.add(_elem306); + Column _elem304; // required + _elem304 = new Column(); + _elem304.read(iprot); + struct.expected.add(_elem304); } } struct.setExpectedIsSet(true); } if (incoming.get(1)) { { - org.apache.thrift.protocol.TList _list307 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.updates = new ArrayList(_list307.size); - for (int _i308 = 0; _i308 < _list307.size; ++_i308) + org.apache.thrift.protocol.TList _list305 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.updates = new ArrayList(_list305.size); + for (int _i306 = 0; _i306 < _list305.size; ++_i306) { - Column _elem309; // required - _elem309 = new Column(); - _elem309.read(iprot); - struct.updates.add(_elem309); + Column _elem307; // required + _elem307 = new Column(); + _elem307.read(iprot); + struct.updates.add(_elem307); } } struct.setUpdatesIsSet(true); @@ -24569,38 +24569,38 @@ public class Cassandra { case 1: // MUTATION_MAP if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map310 = iprot.readMapBegin(); - struct.mutation_map = new HashMap>>(2*_map310.size); - for (int _i311 = 0; _i311 < _map310.size; ++_i311) + org.apache.thrift.protocol.TMap _map308 = iprot.readMapBegin(); + struct.mutation_map = new HashMap>>(2*_map308.size); + for (int _i309 = 0; _i309 < _map308.size; ++_i309) { - ByteBuffer _key312; // required - Map> _val313; // required - _key312 = iprot.readBinary(); + ByteBuffer _key310; // optional + Map> _val311; // required + _key310 = iprot.readBinary(); { - org.apache.thrift.protocol.TMap _map314 = iprot.readMapBegin(); - _val313 = new HashMap>(2*_map314.size); - for (int _i315 = 0; _i315 < _map314.size; ++_i315) + org.apache.thrift.protocol.TMap _map312 = iprot.readMapBegin(); + _val311 = new HashMap>(2*_map312.size); + for (int _i313 = 0; _i313 < _map312.size; ++_i313) { - String _key316; // required - List _val317; // required - _key316 = iprot.readString(); + String _key314; // optional + List _val315; // required + _key314 = iprot.readString(); { - org.apache.thrift.protocol.TList _list318 = iprot.readListBegin(); - _val317 = new ArrayList(_list318.size); - for (int _i319 = 0; _i319 < _list318.size; ++_i319) + org.apache.thrift.protocol.TList _list316 = iprot.readListBegin(); + _val315 = new ArrayList(_list316.size); + for (int _i317 = 0; _i317 < _list316.size; ++_i317) { - Mutation _elem320; // required - _elem320 = new Mutation(); - _elem320.read(iprot); - _val317.add(_elem320); + Mutation _elem318; // required + _elem318 = new Mutation(); + _elem318.read(iprot); + _val315.add(_elem318); } iprot.readListEnd(); } - _val313.put(_key316, _val317); + _val311.put(_key314, _val315); } iprot.readMapEnd(); } - struct.mutation_map.put(_key312, _val313); + struct.mutation_map.put(_key310, _val311); } iprot.readMapEnd(); } @@ -24636,19 +24636,19 @@ public class Cassandra { oprot.writeFieldBegin(MUTATION_MAP_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.MAP, struct.mutation_map.size())); - for (Map.Entry>> _iter321 : struct.mutation_map.entrySet()) + for (Map.Entry>> _iter319 : struct.mutation_map.entrySet()) { - oprot.writeBinary(_iter321.getKey()); + oprot.writeBinary(_iter319.getKey()); { - oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, _iter321.getValue().size())); - for (Map.Entry> _iter322 : _iter321.getValue().entrySet()) + oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, _iter319.getValue().size())); + for (Map.Entry> _iter320 : _iter319.getValue().entrySet()) { - oprot.writeString(_iter322.getKey()); + oprot.writeString(_iter320.getKey()); { - oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, _iter322.getValue().size())); - for (Mutation _iter323 : _iter322.getValue()) + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, _iter320.getValue().size())); + for (Mutation _iter321 : _iter320.getValue()) { - _iter323.write(oprot); + _iter321.write(oprot); } oprot.writeListEnd(); } @@ -24684,19 +24684,19 @@ public class Cassandra { TTupleProtocol oprot = (TTupleProtocol) prot; { oprot.writeI32(struct.mutation_map.size()); - for (Map.Entry>> _iter324 : struct.mutation_map.entrySet()) + for (Map.Entry>> _iter322 : struct.mutation_map.entrySet()) { - oprot.writeBinary(_iter324.getKey()); + oprot.writeBinary(_iter322.getKey()); { - oprot.writeI32(_iter324.getValue().size()); - for (Map.Entry> _iter325 : _iter324.getValue().entrySet()) + oprot.writeI32(_iter322.getValue().size()); + for (Map.Entry> _iter323 : _iter322.getValue().entrySet()) { - oprot.writeString(_iter325.getKey()); + oprot.writeString(_iter323.getKey()); { - oprot.writeI32(_iter325.getValue().size()); - for (Mutation _iter326 : _iter325.getValue()) + oprot.writeI32(_iter323.getValue().size()); + for (Mutation _iter324 : _iter323.getValue()) { - _iter326.write(oprot); + _iter324.write(oprot); } } } @@ -24710,36 +24710,36 @@ public class Cassandra { public void read(org.apache.thrift.protocol.TProtocol prot, batch_mutate_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; { - org.apache.thrift.protocol.TMap _map327 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.MAP, iprot.readI32()); - struct.mutation_map = new HashMap>>(2*_map327.size); - for (int _i328 = 0; _i328 < _map327.size; ++_i328) + org.apache.thrift.protocol.TMap _map325 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.MAP, iprot.readI32()); + struct.mutation_map = new HashMap>>(2*_map325.size); + for (int _i326 = 0; _i326 < _map325.size; ++_i326) { - ByteBuffer _key329; // required - Map> _val330; // required - _key329 = iprot.readBinary(); + ByteBuffer _key327; // optional + Map> _val328; // required + _key327 = iprot.readBinary(); { - org.apache.thrift.protocol.TMap _map331 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, iprot.readI32()); - _val330 = new HashMap>(2*_map331.size); - for (int _i332 = 0; _i332 < _map331.size; ++_i332) + org.apache.thrift.protocol.TMap _map329 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, iprot.readI32()); + _val328 = new HashMap>(2*_map329.size); + for (int _i330 = 0; _i330 < _map329.size; ++_i330) { - String _key333; // required - List _val334; // required - _key333 = iprot.readString(); + String _key331; // optional + List _val332; // required + _key331 = iprot.readString(); { - org.apache.thrift.protocol.TList _list335 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - _val334 = new ArrayList(_list335.size); - for (int _i336 = 0; _i336 < _list335.size; ++_i336) + org.apache.thrift.protocol.TList _list333 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + _val332 = new ArrayList(_list333.size); + for (int _i334 = 0; _i334 < _list333.size; ++_i334) { - Mutation _elem337; // required - _elem337 = new Mutation(); - _elem337.read(iprot); - _val334.add(_elem337); + Mutation _elem335; // required + _elem335 = new Mutation(); + _elem335.read(iprot); + _val332.add(_elem335); } } - _val330.put(_key333, _val334); + _val328.put(_key331, _val332); } } - struct.mutation_map.put(_key329, _val330); + struct.mutation_map.put(_key327, _val328); } } struct.setMutation_mapIsSet(true); @@ -25773,38 +25773,38 @@ public class Cassandra { case 1: // MUTATION_MAP if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map338 = iprot.readMapBegin(); - struct.mutation_map = new HashMap>>(2*_map338.size); - for (int _i339 = 0; _i339 < _map338.size; ++_i339) + org.apache.thrift.protocol.TMap _map336 = iprot.readMapBegin(); + struct.mutation_map = new HashMap>>(2*_map336.size); + for (int _i337 = 0; _i337 < _map336.size; ++_i337) { - ByteBuffer _key340; // required - Map> _val341; // required - _key340 = iprot.readBinary(); + ByteBuffer _key338; // optional + Map> _val339; // required + _key338 = iprot.readBinary(); { - org.apache.thrift.protocol.TMap _map342 = iprot.readMapBegin(); - _val341 = new HashMap>(2*_map342.size); - for (int _i343 = 0; _i343 < _map342.size; ++_i343) + org.apache.thrift.protocol.TMap _map340 = iprot.readMapBegin(); + _val339 = new HashMap>(2*_map340.size); + for (int _i341 = 0; _i341 < _map340.size; ++_i341) { - String _key344; // required - List _val345; // required - _key344 = iprot.readString(); + String _key342; // optional + List _val343; // required + _key342 = iprot.readString(); { - org.apache.thrift.protocol.TList _list346 = iprot.readListBegin(); - _val345 = new ArrayList(_list346.size); - for (int _i347 = 0; _i347 < _list346.size; ++_i347) + org.apache.thrift.protocol.TList _list344 = iprot.readListBegin(); + _val343 = new ArrayList(_list344.size); + for (int _i345 = 0; _i345 < _list344.size; ++_i345) { - Mutation _elem348; // required - _elem348 = new Mutation(); - _elem348.read(iprot); - _val345.add(_elem348); + Mutation _elem346; // required + _elem346 = new Mutation(); + _elem346.read(iprot); + _val343.add(_elem346); } iprot.readListEnd(); } - _val341.put(_key344, _val345); + _val339.put(_key342, _val343); } iprot.readMapEnd(); } - struct.mutation_map.put(_key340, _val341); + struct.mutation_map.put(_key338, _val339); } iprot.readMapEnd(); } @@ -25840,19 +25840,19 @@ public class Cassandra { oprot.writeFieldBegin(MUTATION_MAP_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.MAP, struct.mutation_map.size())); - for (Map.Entry>> _iter349 : struct.mutation_map.entrySet()) + for (Map.Entry>> _iter347 : struct.mutation_map.entrySet()) { - oprot.writeBinary(_iter349.getKey()); + oprot.writeBinary(_iter347.getKey()); { - oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, _iter349.getValue().size())); - for (Map.Entry> _iter350 : _iter349.getValue().entrySet()) + oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, _iter347.getValue().size())); + for (Map.Entry> _iter348 : _iter347.getValue().entrySet()) { - oprot.writeString(_iter350.getKey()); + oprot.writeString(_iter348.getKey()); { - oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, _iter350.getValue().size())); - for (Mutation _iter351 : _iter350.getValue()) + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, _iter348.getValue().size())); + for (Mutation _iter349 : _iter348.getValue()) { - _iter351.write(oprot); + _iter349.write(oprot); } oprot.writeListEnd(); } @@ -25888,19 +25888,19 @@ public class Cassandra { TTupleProtocol oprot = (TTupleProtocol) prot; { oprot.writeI32(struct.mutation_map.size()); - for (Map.Entry>> _iter352 : struct.mutation_map.entrySet()) + for (Map.Entry>> _iter350 : struct.mutation_map.entrySet()) { - oprot.writeBinary(_iter352.getKey()); + oprot.writeBinary(_iter350.getKey()); { - oprot.writeI32(_iter352.getValue().size()); - for (Map.Entry> _iter353 : _iter352.getValue().entrySet()) + oprot.writeI32(_iter350.getValue().size()); + for (Map.Entry> _iter351 : _iter350.getValue().entrySet()) { - oprot.writeString(_iter353.getKey()); + oprot.writeString(_iter351.getKey()); { - oprot.writeI32(_iter353.getValue().size()); - for (Mutation _iter354 : _iter353.getValue()) + oprot.writeI32(_iter351.getValue().size()); + for (Mutation _iter352 : _iter351.getValue()) { - _iter354.write(oprot); + _iter352.write(oprot); } } } @@ -25914,36 +25914,36 @@ public class Cassandra { public void read(org.apache.thrift.protocol.TProtocol prot, atomic_batch_mutate_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; { - org.apache.thrift.protocol.TMap _map355 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.MAP, iprot.readI32()); - struct.mutation_map = new HashMap>>(2*_map355.size); - for (int _i356 = 0; _i356 < _map355.size; ++_i356) + org.apache.thrift.protocol.TMap _map353 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.MAP, iprot.readI32()); + struct.mutation_map = new HashMap>>(2*_map353.size); + for (int _i354 = 0; _i354 < _map353.size; ++_i354) { - ByteBuffer _key357; // required - Map> _val358; // required - _key357 = iprot.readBinary(); + ByteBuffer _key355; // optional + Map> _val356; // required + _key355 = iprot.readBinary(); { - org.apache.thrift.protocol.TMap _map359 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, iprot.readI32()); - _val358 = new HashMap>(2*_map359.size); - for (int _i360 = 0; _i360 < _map359.size; ++_i360) + org.apache.thrift.protocol.TMap _map357 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, iprot.readI32()); + _val356 = new HashMap>(2*_map357.size); + for (int _i358 = 0; _i358 < _map357.size; ++_i358) { - String _key361; // required - List _val362; // required - _key361 = iprot.readString(); + String _key359; // optional + List _val360; // required + _key359 = iprot.readString(); { - org.apache.thrift.protocol.TList _list363 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - _val362 = new ArrayList(_list363.size); - for (int _i364 = 0; _i364 < _list363.size; ++_i364) + org.apache.thrift.protocol.TList _list361 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + _val360 = new ArrayList(_list361.size); + for (int _i362 = 0; _i362 < _list361.size; ++_i362) { - Mutation _elem365; // required - _elem365 = new Mutation(); - _elem365.read(iprot); - _val362.add(_elem365); + Mutation _elem363; // required + _elem363 = new Mutation(); + _elem363.read(iprot); + _val360.add(_elem363); } } - _val358.put(_key361, _val362); + _val356.put(_key359, _val360); } } - struct.mutation_map.put(_key357, _val358); + struct.mutation_map.put(_key355, _val356); } } struct.setMutation_mapIsSet(true); @@ -28117,25 +28117,25 @@ public class Cassandra { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map366 = iprot.readMapBegin(); - struct.success = new HashMap>(2*_map366.size); - for (int _i367 = 0; _i367 < _map366.size; ++_i367) + org.apache.thrift.protocol.TMap _map364 = iprot.readMapBegin(); + struct.success = new HashMap>(2*_map364.size); + for (int _i365 = 0; _i365 < _map364.size; ++_i365) { - String _key368; // required - List _val369; // required - _key368 = iprot.readString(); + String _key366; // optional + List _val367; // required + _key366 = iprot.readString(); { - org.apache.thrift.protocol.TList _list370 = iprot.readListBegin(); - _val369 = new ArrayList(_list370.size); - for (int _i371 = 0; _i371 < _list370.size; ++_i371) + org.apache.thrift.protocol.TList _list368 = iprot.readListBegin(); + _val367 = new ArrayList(_list368.size); + for (int _i369 = 0; _i369 < _list368.size; ++_i369) { - String _elem372; // required - _elem372 = iprot.readString(); - _val369.add(_elem372); + String _elem370; // required + _elem370 = iprot.readString(); + _val367.add(_elem370); } iprot.readListEnd(); } - struct.success.put(_key368, _val369); + struct.success.put(_key366, _val367); } iprot.readMapEnd(); } @@ -28172,14 +28172,14 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, struct.success.size())); - for (Map.Entry> _iter373 : struct.success.entrySet()) + for (Map.Entry> _iter371 : struct.success.entrySet()) { - oprot.writeString(_iter373.getKey()); + oprot.writeString(_iter371.getKey()); { - oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, _iter373.getValue().size())); - for (String _iter374 : _iter373.getValue()) + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, _iter371.getValue().size())); + for (String _iter372 : _iter371.getValue()) { - oprot.writeString(_iter374); + oprot.writeString(_iter372); } oprot.writeListEnd(); } @@ -28221,14 +28221,14 @@ public class Cassandra { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Map.Entry> _iter375 : struct.success.entrySet()) + for (Map.Entry> _iter373 : struct.success.entrySet()) { - oprot.writeString(_iter375.getKey()); + oprot.writeString(_iter373.getKey()); { - oprot.writeI32(_iter375.getValue().size()); - for (String _iter376 : _iter375.getValue()) + oprot.writeI32(_iter373.getValue().size()); + for (String _iter374 : _iter373.getValue()) { - oprot.writeString(_iter376); + oprot.writeString(_iter374); } } } @@ -28245,24 +28245,24 @@ public class Cassandra { BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { { - org.apache.thrift.protocol.TMap _map377 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, iprot.readI32()); - struct.success = new HashMap>(2*_map377.size); - for (int _i378 = 0; _i378 < _map377.size; ++_i378) + org.apache.thrift.protocol.TMap _map375 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, iprot.readI32()); + struct.success = new HashMap>(2*_map375.size); + for (int _i376 = 0; _i376 < _map375.size; ++_i376) { - String _key379; // required - List _val380; // required - _key379 = iprot.readString(); + String _key377; // optional + List _val378; // required + _key377 = iprot.readString(); { - org.apache.thrift.protocol.TList _list381 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - _val380 = new ArrayList(_list381.size); - for (int _i382 = 0; _i382 < _list381.size; ++_i382) + org.apache.thrift.protocol.TList _list379 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + _val378 = new ArrayList(_list379.size); + for (int _i380 = 0; _i380 < _list379.size; ++_i380) { - String _elem383; // required - _elem383 = iprot.readString(); - _val380.add(_elem383); + String _elem381; // required + _elem381 = iprot.readString(); + _val378.add(_elem381); } } - struct.success.put(_key379, _val380); + struct.success.put(_key377, _val378); } } struct.setSuccessIsSet(true); @@ -28923,14 +28923,14 @@ public class Cassandra { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list384 = iprot.readListBegin(); - struct.success = new ArrayList(_list384.size); - for (int _i385 = 0; _i385 < _list384.size; ++_i385) + org.apache.thrift.protocol.TList _list382 = iprot.readListBegin(); + struct.success = new ArrayList(_list382.size); + for (int _i383 = 0; _i383 < _list382.size; ++_i383) { - KsDef _elem386; // required - _elem386 = new KsDef(); - _elem386.read(iprot); - struct.success.add(_elem386); + KsDef _elem384; // required + _elem384 = new KsDef(); + _elem384.read(iprot); + struct.success.add(_elem384); } iprot.readListEnd(); } @@ -28967,9 +28967,9 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (KsDef _iter387 : struct.success) + for (KsDef _iter385 : struct.success) { - _iter387.write(oprot); + _iter385.write(oprot); } oprot.writeListEnd(); } @@ -29008,9 +29008,9 @@ public class Cassandra { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (KsDef _iter388 : struct.success) + for (KsDef _iter386 : struct.success) { - _iter388.write(oprot); + _iter386.write(oprot); } } } @@ -29025,14 +29025,14 @@ public class Cassandra { BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list389 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList(_list389.size); - for (int _i390 = 0; _i390 < _list389.size; ++_i390) + org.apache.thrift.protocol.TList _list387 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList(_list387.size); + for (int _i388 = 0; _i388 < _list387.size; ++_i388) { - KsDef _elem391; // required - _elem391 = new KsDef(); - _elem391.read(iprot); - struct.success.add(_elem391); + KsDef _elem389; // required + _elem389 = new KsDef(); + _elem389.read(iprot); + struct.success.add(_elem389); } } struct.setSuccessIsSet(true); @@ -31017,14 +31017,14 @@ public class Cassandra { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list392 = iprot.readListBegin(); - struct.success = new ArrayList(_list392.size); - for (int _i393 = 0; _i393 < _list392.size; ++_i393) + org.apache.thrift.protocol.TList _list390 = iprot.readListBegin(); + struct.success = new ArrayList(_list390.size); + for (int _i391 = 0; _i391 < _list390.size; ++_i391) { - TokenRange _elem394; // required - _elem394 = new TokenRange(); - _elem394.read(iprot); - struct.success.add(_elem394); + TokenRange _elem392; // required + _elem392 = new TokenRange(); + _elem392.read(iprot); + struct.success.add(_elem392); } iprot.readListEnd(); } @@ -31061,9 +31061,9 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (TokenRange _iter395 : struct.success) + for (TokenRange _iter393 : struct.success) { - _iter395.write(oprot); + _iter393.write(oprot); } oprot.writeListEnd(); } @@ -31102,9 +31102,9 @@ public class Cassandra { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (TokenRange _iter396 : struct.success) + for (TokenRange _iter394 : struct.success) { - _iter396.write(oprot); + _iter394.write(oprot); } } } @@ -31119,14 +31119,14 @@ public class Cassandra { BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list397 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList(_list397.size); - for (int _i398 = 0; _i398 < _list397.size; ++_i398) + org.apache.thrift.protocol.TList _list395 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList(_list395.size); + for (int _i396 = 0; _i396 < _list395.size; ++_i396) { - TokenRange _elem399; // required - _elem399 = new TokenRange(); - _elem399.read(iprot); - struct.success.add(_elem399); + TokenRange _elem397; // required + _elem397 = new TokenRange(); + _elem397.read(iprot); + struct.success.add(_elem397); } } struct.setSuccessIsSet(true); @@ -31792,15 +31792,15 @@ public class Cassandra { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map400 = iprot.readMapBegin(); - struct.success = new HashMap(2*_map400.size); - for (int _i401 = 0; _i401 < _map400.size; ++_i401) + org.apache.thrift.protocol.TMap _map398 = iprot.readMapBegin(); + struct.success = new HashMap(2*_map398.size); + for (int _i399 = 0; _i399 < _map398.size; ++_i399) { - String _key402; // required - String _val403; // required - _key402 = iprot.readString(); - _val403 = iprot.readString(); - struct.success.put(_key402, _val403); + String _key400; // optional + String _val401; // required + _key400 = iprot.readString(); + _val401 = iprot.readString(); + struct.success.put(_key400, _val401); } iprot.readMapEnd(); } @@ -31837,10 +31837,10 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.success.size())); - for (Map.Entry _iter404 : struct.success.entrySet()) + for (Map.Entry _iter402 : struct.success.entrySet()) { - oprot.writeString(_iter404.getKey()); - oprot.writeString(_iter404.getValue()); + oprot.writeString(_iter402.getKey()); + oprot.writeString(_iter402.getValue()); } oprot.writeMapEnd(); } @@ -31879,10 +31879,10 @@ public class Cassandra { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Map.Entry _iter405 : struct.success.entrySet()) + for (Map.Entry _iter403 : struct.success.entrySet()) { - oprot.writeString(_iter405.getKey()); - oprot.writeString(_iter405.getValue()); + oprot.writeString(_iter403.getKey()); + oprot.writeString(_iter403.getValue()); } } } @@ -31897,15 +31897,15 @@ public class Cassandra { BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { { - org.apache.thrift.protocol.TMap _map406 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.success = new HashMap(2*_map406.size); - for (int _i407 = 0; _i407 < _map406.size; ++_i407) + org.apache.thrift.protocol.TMap _map404 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.success = new HashMap(2*_map404.size); + for (int _i405 = 0; _i405 < _map404.size; ++_i405) { - String _key408; // required - String _val409; // required - _key408 = iprot.readString(); - _val409 = iprot.readString(); - struct.success.put(_key408, _val409); + String _key406; // optional + String _val407; // required + _key406 = iprot.readString(); + _val407 = iprot.readString(); + struct.success.put(_key406, _val407); } } struct.setSuccessIsSet(true); @@ -35126,13 +35126,13 @@ public class Cassandra { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list410 = iprot.readListBegin(); - struct.success = new ArrayList(_list410.size); - for (int _i411 = 0; _i411 < _list410.size; ++_i411) + org.apache.thrift.protocol.TList _list408 = iprot.readListBegin(); + struct.success = new ArrayList(_list408.size); + for (int _i409 = 0; _i409 < _list408.size; ++_i409) { - String _elem412; // required - _elem412 = iprot.readString(); - struct.success.add(_elem412); + String _elem410; // required + _elem410 = iprot.readString(); + struct.success.add(_elem410); } iprot.readListEnd(); } @@ -35169,9 +35169,9 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.success.size())); - for (String _iter413 : struct.success) + for (String _iter411 : struct.success) { - oprot.writeString(_iter413); + oprot.writeString(_iter411); } oprot.writeListEnd(); } @@ -35210,9 +35210,9 @@ public class Cassandra { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (String _iter414 : struct.success) + for (String _iter412 : struct.success) { - oprot.writeString(_iter414); + oprot.writeString(_iter412); } } } @@ -35227,13 +35227,13 @@ public class Cassandra { BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list415 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.success = new ArrayList(_list415.size); - for (int _i416 = 0; _i416 < _list415.size; ++_i416) + org.apache.thrift.protocol.TList _list413 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.success = new ArrayList(_list413.size); + for (int _i414 = 0; _i414 < _list413.size; ++_i414) { - String _elem417; // required - _elem417 = iprot.readString(); - struct.success.add(_elem417); + String _elem415; // required + _elem415 = iprot.readString(); + struct.success.add(_elem415); } } struct.setSuccessIsSet(true); @@ -36922,14 +36922,14 @@ public class Cassandra { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list418 = iprot.readListBegin(); - struct.success = new ArrayList(_list418.size); - for (int _i419 = 0; _i419 < _list418.size; ++_i419) + org.apache.thrift.protocol.TList _list416 = iprot.readListBegin(); + struct.success = new ArrayList(_list416.size); + for (int _i417 = 0; _i417 < _list416.size; ++_i417) { - CfSplit _elem420; // required - _elem420 = new CfSplit(); - _elem420.read(iprot); - struct.success.add(_elem420); + CfSplit _elem418; // required + _elem418 = new CfSplit(); + _elem418.read(iprot); + struct.success.add(_elem418); } iprot.readListEnd(); } @@ -36966,9 +36966,9 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (CfSplit _iter421 : struct.success) + for (CfSplit _iter419 : struct.success) { - _iter421.write(oprot); + _iter419.write(oprot); } oprot.writeListEnd(); } @@ -37007,9 +37007,9 @@ public class Cassandra { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (CfSplit _iter422 : struct.success) + for (CfSplit _iter420 : struct.success) { - _iter422.write(oprot); + _iter420.write(oprot); } } } @@ -37024,14 +37024,14 @@ public class Cassandra { BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list423 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList(_list423.size); - for (int _i424 = 0; _i424 < _list423.size; ++_i424) + org.apache.thrift.protocol.TList _list421 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList(_list421.size); + for (int _i422 = 0; _i422 < _list421.size; ++_i422) { - CfSplit _elem425; // required - _elem425 = new CfSplit(); - _elem425.read(iprot); - struct.success.add(_elem425); + CfSplit _elem423; // required + _elem423 = new CfSplit(); + _elem423.read(iprot); + struct.success.add(_elem423); } } struct.setSuccessIsSet(true); @@ -47631,13 +47631,13 @@ public class Cassandra { case 2: // VALUES if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list426 = iprot.readListBegin(); - struct.values = new ArrayList(_list426.size); - for (int _i427 = 0; _i427 < _list426.size; ++_i427) + org.apache.thrift.protocol.TList _list424 = iprot.readListBegin(); + struct.values = new ArrayList(_list424.size); + for (int _i425 = 0; _i425 < _list424.size; ++_i425) { - ByteBuffer _elem428; // required - _elem428 = iprot.readBinary(); - struct.values.add(_elem428); + ByteBuffer _elem426; // required + _elem426 = iprot.readBinary(); + struct.values.add(_elem426); } iprot.readListEnd(); } @@ -47671,9 +47671,9 @@ public class Cassandra { oprot.writeFieldBegin(VALUES_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.values.size())); - for (ByteBuffer _iter429 : struct.values) + for (ByteBuffer _iter427 : struct.values) { - oprot.writeBinary(_iter429); + oprot.writeBinary(_iter427); } oprot.writeListEnd(); } @@ -47699,9 +47699,9 @@ public class Cassandra { oprot.writeI32(struct.itemId); { oprot.writeI32(struct.values.size()); - for (ByteBuffer _iter430 : struct.values) + for (ByteBuffer _iter428 : struct.values) { - oprot.writeBinary(_iter430); + oprot.writeBinary(_iter428); } } } @@ -47712,13 +47712,13 @@ public class Cassandra { struct.itemId = iprot.readI32(); struct.setItemIdIsSet(true); { - org.apache.thrift.protocol.TList _list431 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.values = new ArrayList(_list431.size); - for (int _i432 = 0; _i432 < _list431.size; ++_i432) + org.apache.thrift.protocol.TList _list429 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.values = new ArrayList(_list429.size); + for (int _i430 = 0; _i430 < _list429.size; ++_i430) { - ByteBuffer _elem433; // required - _elem433 = iprot.readBinary(); - struct.values.add(_elem433); + ByteBuffer _elem431; // required + _elem431 = iprot.readBinary(); + struct.values.add(_elem431); } } struct.setValuesIsSet(true); @@ -49034,13 +49034,13 @@ public class Cassandra { case 2: // VALUES if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list434 = iprot.readListBegin(); - struct.values = new ArrayList(_list434.size); - for (int _i435 = 0; _i435 < _list434.size; ++_i435) + org.apache.thrift.protocol.TList _list432 = iprot.readListBegin(); + struct.values = new ArrayList(_list432.size); + for (int _i433 = 0; _i433 < _list432.size; ++_i433) { - ByteBuffer _elem436; // required - _elem436 = iprot.readBinary(); - struct.values.add(_elem436); + ByteBuffer _elem434; // required + _elem434 = iprot.readBinary(); + struct.values.add(_elem434); } iprot.readListEnd(); } @@ -49082,9 +49082,9 @@ public class Cassandra { oprot.writeFieldBegin(VALUES_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.values.size())); - for (ByteBuffer _iter437 : struct.values) + for (ByteBuffer _iter435 : struct.values) { - oprot.writeBinary(_iter437); + oprot.writeBinary(_iter435); } oprot.writeListEnd(); } @@ -49115,9 +49115,9 @@ public class Cassandra { oprot.writeI32(struct.itemId); { oprot.writeI32(struct.values.size()); - for (ByteBuffer _iter438 : struct.values) + for (ByteBuffer _iter436 : struct.values) { - oprot.writeBinary(_iter438); + oprot.writeBinary(_iter436); } } oprot.writeI32(struct.consistency.getValue()); @@ -49129,13 +49129,13 @@ public class Cassandra { struct.itemId = iprot.readI32(); struct.setItemIdIsSet(true); { - org.apache.thrift.protocol.TList _list439 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.values = new ArrayList(_list439.size); - for (int _i440 = 0; _i440 < _list439.size; ++_i440) + org.apache.thrift.protocol.TList _list437 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.values = new ArrayList(_list437.size); + for (int _i438 = 0; _i438 < _list437.size; ++_i438) { - ByteBuffer _elem441; // required - _elem441 = iprot.readBinary(); - struct.values.add(_elem441); + ByteBuffer _elem439; // required + _elem439 = iprot.readBinary(); + struct.values.add(_elem439); } } struct.setValuesIsSet(true); 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 85eaef9398..e742cc5d42 100644 --- a/interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java +++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java @@ -82,7 +82,7 @@ public class CfDef implements org.apache.thrift.TBase, jav private static final org.apache.thrift.protocol.TField DEFAULT_TIME_TO_LIVE_FIELD_DESC = new org.apache.thrift.protocol.TField("default_time_to_live", org.apache.thrift.protocol.TType.I32, (short)40); private static final org.apache.thrift.protocol.TField INDEX_INTERVAL_FIELD_DESC = new org.apache.thrift.protocol.TField("index_interval", org.apache.thrift.protocol.TType.I32, (short)41); private static final org.apache.thrift.protocol.TField SPECULATIVE_RETRY_FIELD_DESC = new org.apache.thrift.protocol.TField("speculative_retry", org.apache.thrift.protocol.TType.STRING, (short)42); - private static final org.apache.thrift.protocol.TField TRIGGERS_FIELD_DESC = new org.apache.thrift.protocol.TField("triggers", org.apache.thrift.protocol.TType.MAP, (short)43); + private static final org.apache.thrift.protocol.TField TRIGGERS_FIELD_DESC = new org.apache.thrift.protocol.TField("triggers", org.apache.thrift.protocol.TType.LIST, (short)43); private static final org.apache.thrift.protocol.TField ROW_CACHE_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("row_cache_size", org.apache.thrift.protocol.TType.DOUBLE, (short)9); private static final org.apache.thrift.protocol.TField KEY_CACHE_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("key_cache_size", org.apache.thrift.protocol.TType.DOUBLE, (short)11); private static final org.apache.thrift.protocol.TField ROW_CACHE_SAVE_PERIOD_IN_SECONDS_FIELD_DESC = new org.apache.thrift.protocol.TField("row_cache_save_period_in_seconds", org.apache.thrift.protocol.TType.I32, (short)19); @@ -127,7 +127,7 @@ public class CfDef implements org.apache.thrift.TBase, jav public int default_time_to_live; // optional public int index_interval; // optional public String speculative_retry; // optional - public Map> triggers; // optional + public List triggers; // optional /** * @deprecated */ @@ -455,11 +455,8 @@ public class CfDef implements org.apache.thrift.TBase, jav tmpMap.put(_Fields.SPECULATIVE_RETRY, new org.apache.thrift.meta_data.FieldMetaData("speculative_retry", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.TRIGGERS, new org.apache.thrift.meta_data.FieldMetaData("triggers", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), - new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))))); + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TriggerDef.class)))); tmpMap.put(_Fields.ROW_CACHE_SIZE, new org.apache.thrift.meta_data.FieldMetaData("row_cache_size", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE))); tmpMap.put(_Fields.KEY_CACHE_SIZE, new org.apache.thrift.meta_data.FieldMetaData("key_cache_size", org.apache.thrift.TFieldRequirementType.OPTIONAL, @@ -598,28 +595,9 @@ public class CfDef implements org.apache.thrift.TBase, jav this.speculative_retry = other.speculative_retry; } if (other.isSetTriggers()) { - Map> __this__triggers = new HashMap>(); - for (Map.Entry> other_element : other.triggers.entrySet()) { - - String other_element_key = other_element.getKey(); - Map other_element_value = other_element.getValue(); - - String __this__triggers_copy_key = other_element_key; - - Map __this__triggers_copy_value = new HashMap(); - for (Map.Entry other_element_value_element : other_element_value.entrySet()) { - - String other_element_value_element_key = other_element_value_element.getKey(); - String other_element_value_element_value = other_element_value_element.getValue(); - - String __this__triggers_copy_value_copy_key = other_element_value_element_key; - - String __this__triggers_copy_value_copy_value = other_element_value_element_value; - - __this__triggers_copy_value.put(__this__triggers_copy_value_copy_key, __this__triggers_copy_value_copy_value); - } - - __this__triggers.put(__this__triggers_copy_key, __this__triggers_copy_value); + List __this__triggers = new ArrayList(); + for (TriggerDef other_element : other.triggers) { + __this__triggers.add(new TriggerDef(other_element)); } this.triggers = __this__triggers; } @@ -1395,18 +1373,22 @@ public class CfDef implements org.apache.thrift.TBase, jav return (this.triggers == null) ? 0 : this.triggers.size(); } - public void putToTriggers(String key, Map val) { - if (this.triggers == null) { - this.triggers = new HashMap>(); - } - this.triggers.put(key, val); + public java.util.Iterator getTriggersIterator() { + return (this.triggers == null) ? null : this.triggers.iterator(); } - public Map> getTriggers() { + public void addToTriggers(TriggerDef elem) { + if (this.triggers == null) { + this.triggers = new ArrayList(); + } + this.triggers.add(elem); + } + + public List getTriggers() { return this.triggers; } - public CfDef setTriggers(Map> triggers) { + public CfDef setTriggers(List triggers) { this.triggers = triggers; return this; } @@ -1939,7 +1921,7 @@ public class CfDef implements org.apache.thrift.TBase, jav if (value == null) { unsetTriggers(); } else { - setTriggers((Map>)value); + setTriggers((List)value); } break; @@ -3597,14 +3579,14 @@ public class CfDef implements org.apache.thrift.TBase, jav case 13: // COLUMN_METADATA if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list100 = iprot.readListBegin(); - struct.column_metadata = new ArrayList(_list100.size); - for (int _i101 = 0; _i101 < _list100.size; ++_i101) + org.apache.thrift.protocol.TList _list110 = iprot.readListBegin(); + struct.column_metadata = new ArrayList(_list110.size); + for (int _i111 = 0; _i111 < _list110.size; ++_i111) { - ColumnDef _elem102; // required - _elem102 = new ColumnDef(); - _elem102.read(iprot); - struct.column_metadata.add(_elem102); + ColumnDef _elem112; // required + _elem112 = new ColumnDef(); + _elem112.read(iprot); + struct.column_metadata.add(_elem112); } iprot.readListEnd(); } @@ -3688,15 +3670,15 @@ public class CfDef implements org.apache.thrift.TBase, jav case 30: // COMPACTION_STRATEGY_OPTIONS if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map103 = iprot.readMapBegin(); - struct.compaction_strategy_options = new HashMap(2*_map103.size); - for (int _i104 = 0; _i104 < _map103.size; ++_i104) + org.apache.thrift.protocol.TMap _map113 = iprot.readMapBegin(); + struct.compaction_strategy_options = new HashMap(2*_map113.size); + for (int _i114 = 0; _i114 < _map113.size; ++_i114) { - String _key105; // required - String _val106; // required - _key105 = iprot.readString(); - _val106 = iprot.readString(); - struct.compaction_strategy_options.put(_key105, _val106); + String _key115; // optional + String _val116; // required + _key115 = iprot.readString(); + _val116 = iprot.readString(); + struct.compaction_strategy_options.put(_key115, _val116); } iprot.readMapEnd(); } @@ -3708,15 +3690,15 @@ public class CfDef implements org.apache.thrift.TBase, jav case 32: // COMPRESSION_OPTIONS if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map107 = iprot.readMapBegin(); - struct.compression_options = new HashMap(2*_map107.size); - for (int _i108 = 0; _i108 < _map107.size; ++_i108) + org.apache.thrift.protocol.TMap _map117 = iprot.readMapBegin(); + struct.compression_options = new HashMap(2*_map117.size); + for (int _i118 = 0; _i118 < _map117.size; ++_i118) { - String _key109; // required - String _val110; // required - _key109 = iprot.readString(); - _val110 = iprot.readString(); - struct.compression_options.put(_key109, _val110); + String _key119; // optional + String _val120; // required + _key119 = iprot.readString(); + _val120 = iprot.readString(); + struct.compression_options.put(_key119, _val120); } iprot.readMapEnd(); } @@ -3790,31 +3772,18 @@ public class CfDef implements org.apache.thrift.TBase, jav } break; case 43: // TRIGGERS - if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TMap _map111 = iprot.readMapBegin(); - struct.triggers = new HashMap>(2*_map111.size); - for (int _i112 = 0; _i112 < _map111.size; ++_i112) + org.apache.thrift.protocol.TList _list121 = iprot.readListBegin(); + struct.triggers = new ArrayList(_list121.size); + for (int _i122 = 0; _i122 < _list121.size; ++_i122) { - String _key113; // required - Map _val114; // required - _key113 = iprot.readString(); - { - org.apache.thrift.protocol.TMap _map115 = iprot.readMapBegin(); - _val114 = new HashMap(2*_map115.size); - for (int _i116 = 0; _i116 < _map115.size; ++_i116) - { - String _key117; // required - String _val118; // required - _key117 = iprot.readString(); - _val118 = iprot.readString(); - _val114.put(_key117, _val118); - } - iprot.readMapEnd(); - } - struct.triggers.put(_key113, _val114); + TriggerDef _elem123; // required + _elem123 = new TriggerDef(); + _elem123.read(iprot); + struct.triggers.add(_elem123); } - iprot.readMapEnd(); + iprot.readListEnd(); } struct.setTriggersIsSet(true); } else { @@ -3974,9 +3943,9 @@ public class CfDef implements org.apache.thrift.TBase, jav oprot.writeFieldBegin(COLUMN_METADATA_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.column_metadata.size())); - for (ColumnDef _iter119 : struct.column_metadata) + for (ColumnDef _iter124 : struct.column_metadata) { - _iter119.write(oprot); + _iter124.write(oprot); } oprot.writeListEnd(); } @@ -4078,10 +4047,10 @@ public class CfDef implements org.apache.thrift.TBase, jav oprot.writeFieldBegin(COMPACTION_STRATEGY_OPTIONS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.compaction_strategy_options.size())); - for (Map.Entry _iter120 : struct.compaction_strategy_options.entrySet()) + for (Map.Entry _iter125 : struct.compaction_strategy_options.entrySet()) { - oprot.writeString(_iter120.getKey()); - oprot.writeString(_iter120.getValue()); + oprot.writeString(_iter125.getKey()); + oprot.writeString(_iter125.getValue()); } oprot.writeMapEnd(); } @@ -4098,10 +4067,10 @@ public class CfDef implements org.apache.thrift.TBase, jav oprot.writeFieldBegin(COMPRESSION_OPTIONS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.compression_options.size())); - for (Map.Entry _iter121 : struct.compression_options.entrySet()) + for (Map.Entry _iter126 : struct.compression_options.entrySet()) { - oprot.writeString(_iter121.getKey()); - oprot.writeString(_iter121.getValue()); + oprot.writeString(_iter126.getKey()); + oprot.writeString(_iter126.getValue()); } oprot.writeMapEnd(); } @@ -4156,21 +4125,12 @@ public class CfDef implements org.apache.thrift.TBase, jav if (struct.isSetTriggers()) { oprot.writeFieldBegin(TRIGGERS_FIELD_DESC); { - oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.MAP, struct.triggers.size())); - for (Map.Entry> _iter122 : struct.triggers.entrySet()) + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.triggers.size())); + for (TriggerDef _iter127 : struct.triggers) { - oprot.writeString(_iter122.getKey()); - { - oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, _iter122.getValue().size())); - for (Map.Entry _iter123 : _iter122.getValue().entrySet()) - { - oprot.writeString(_iter123.getKey()); - oprot.writeString(_iter123.getValue()); - } - oprot.writeMapEnd(); - } + _iter127.write(oprot); } - oprot.writeMapEnd(); + oprot.writeListEnd(); } oprot.writeFieldEnd(); } @@ -4322,9 +4282,9 @@ public class CfDef implements org.apache.thrift.TBase, jav if (struct.isSetColumn_metadata()) { { oprot.writeI32(struct.column_metadata.size()); - for (ColumnDef _iter124 : struct.column_metadata) + for (ColumnDef _iter128 : struct.column_metadata) { - _iter124.write(oprot); + _iter128.write(oprot); } } } @@ -4358,20 +4318,20 @@ public class CfDef implements org.apache.thrift.TBase, jav if (struct.isSetCompaction_strategy_options()) { { oprot.writeI32(struct.compaction_strategy_options.size()); - for (Map.Entry _iter125 : struct.compaction_strategy_options.entrySet()) + for (Map.Entry _iter129 : struct.compaction_strategy_options.entrySet()) { - oprot.writeString(_iter125.getKey()); - oprot.writeString(_iter125.getValue()); + oprot.writeString(_iter129.getKey()); + oprot.writeString(_iter129.getValue()); } } } if (struct.isSetCompression_options()) { { oprot.writeI32(struct.compression_options.size()); - for (Map.Entry _iter126 : struct.compression_options.entrySet()) + for (Map.Entry _iter130 : struct.compression_options.entrySet()) { - oprot.writeString(_iter126.getKey()); - oprot.writeString(_iter126.getValue()); + oprot.writeString(_iter130.getKey()); + oprot.writeString(_iter130.getValue()); } } } @@ -4402,17 +4362,9 @@ public class CfDef implements org.apache.thrift.TBase, jav if (struct.isSetTriggers()) { { oprot.writeI32(struct.triggers.size()); - for (Map.Entry> _iter127 : struct.triggers.entrySet()) + for (TriggerDef _iter131 : struct.triggers) { - oprot.writeString(_iter127.getKey()); - { - oprot.writeI32(_iter127.getValue().size()); - for (Map.Entry _iter128 : _iter127.getValue().entrySet()) - { - oprot.writeString(_iter128.getKey()); - oprot.writeString(_iter128.getValue()); - } - } + _iter131.write(oprot); } } } @@ -4478,14 +4430,14 @@ public class CfDef implements org.apache.thrift.TBase, jav } if (incoming.get(5)) { { - org.apache.thrift.protocol.TList _list129 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.column_metadata = new ArrayList(_list129.size); - for (int _i130 = 0; _i130 < _list129.size; ++_i130) + org.apache.thrift.protocol.TList _list132 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.column_metadata = new ArrayList(_list132.size); + for (int _i133 = 0; _i133 < _list132.size; ++_i133) { - ColumnDef _elem131; // required - _elem131 = new ColumnDef(); - _elem131.read(iprot); - struct.column_metadata.add(_elem131); + ColumnDef _elem134; // required + _elem134 = new ColumnDef(); + _elem134.read(iprot); + struct.column_metadata.add(_elem134); } } struct.setColumn_metadataIsSet(true); @@ -4528,30 +4480,30 @@ public class CfDef implements org.apache.thrift.TBase, jav } if (incoming.get(15)) { { - org.apache.thrift.protocol.TMap _map132 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.compaction_strategy_options = new HashMap(2*_map132.size); - for (int _i133 = 0; _i133 < _map132.size; ++_i133) + org.apache.thrift.protocol.TMap _map135 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.compaction_strategy_options = new HashMap(2*_map135.size); + for (int _i136 = 0; _i136 < _map135.size; ++_i136) { - String _key134; // required - String _val135; // required - _key134 = iprot.readString(); - _val135 = iprot.readString(); - struct.compaction_strategy_options.put(_key134, _val135); + String _key137; // optional + String _val138; // required + _key137 = iprot.readString(); + _val138 = iprot.readString(); + struct.compaction_strategy_options.put(_key137, _val138); } } struct.setCompaction_strategy_optionsIsSet(true); } if (incoming.get(16)) { { - org.apache.thrift.protocol.TMap _map136 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.compression_options = new HashMap(2*_map136.size); - for (int _i137 = 0; _i137 < _map136.size; ++_i137) + org.apache.thrift.protocol.TMap _map139 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.compression_options = new HashMap(2*_map139.size); + for (int _i140 = 0; _i140 < _map139.size; ++_i140) { - String _key138; // required - String _val139; // required - _key138 = iprot.readString(); - _val139 = iprot.readString(); - struct.compression_options.put(_key138, _val139); + String _key141; // optional + String _val142; // required + _key141 = iprot.readString(); + _val142 = iprot.readString(); + struct.compression_options.put(_key141, _val142); } } struct.setCompression_optionsIsSet(true); @@ -4590,26 +4542,14 @@ public class CfDef implements org.apache.thrift.TBase, jav } if (incoming.get(25)) { { - org.apache.thrift.protocol.TMap _map140 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.MAP, iprot.readI32()); - struct.triggers = new HashMap>(2*_map140.size); - for (int _i141 = 0; _i141 < _map140.size; ++_i141) + org.apache.thrift.protocol.TList _list143 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.triggers = new ArrayList(_list143.size); + for (int _i144 = 0; _i144 < _list143.size; ++_i144) { - String _key142; // required - Map _val143; // required - _key142 = iprot.readString(); - { - org.apache.thrift.protocol.TMap _map144 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - _val143 = new HashMap(2*_map144.size); - for (int _i145 = 0; _i145 < _map144.size; ++_i145) - { - String _key146; // required - String _val147; // required - _key146 = iprot.readString(); - _val147 = iprot.readString(); - _val143.put(_key146, _val147); - } - } - struct.triggers.put(_key142, _val143); + TriggerDef _elem145; // required + _elem145 = new TriggerDef(); + _elem145.read(iprot); + struct.triggers.add(_elem145); } } struct.setTriggersIsSet(true); diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnDef.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnDef.java index 35ec3b7f08..1557c3a1c3 100644 --- a/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnDef.java +++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnDef.java @@ -771,7 +771,7 @@ public class ColumnDef implements org.apache.thrift.TBase(2*_map90.size); for (int _i91 = 0; _i91 < _map90.size; ++_i91) { - String _key92; // required + String _key92; // optional String _val93; // required _key92 = iprot.readString(); _val93 = iprot.readString(); @@ -908,7 +908,7 @@ public class ColumnDef implements org.apache.thrift.TBase(2*_map96.size); for (int _i97 = 0; _i97 < _map96.size; ++_i97) { - String _key98; // required + String _key98; // optional String _val99; // required _key98 = iprot.readString(); _val99 = iprot.readString(); diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlMetadata.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlMetadata.java index d0a6033106..7a54c300c9 100644 --- a/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlMetadata.java +++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlMetadata.java @@ -658,15 +658,15 @@ public class CqlMetadata implements org.apache.thrift.TBase(2*_map174.size); - for (int _i175 = 0; _i175 < _map174.size; ++_i175) + org.apache.thrift.protocol.TMap _map172 = iprot.readMapBegin(); + struct.name_types = new HashMap(2*_map172.size); + for (int _i173 = 0; _i173 < _map172.size; ++_i173) { - ByteBuffer _key176; // required - String _val177; // required - _key176 = iprot.readBinary(); - _val177 = iprot.readString(); - struct.name_types.put(_key176, _val177); + ByteBuffer _key174; // optional + String _val175; // required + _key174 = iprot.readBinary(); + _val175 = iprot.readString(); + struct.name_types.put(_key174, _val175); } iprot.readMapEnd(); } @@ -678,15 +678,15 @@ public class CqlMetadata implements org.apache.thrift.TBase(2*_map178.size); - for (int _i179 = 0; _i179 < _map178.size; ++_i179) + org.apache.thrift.protocol.TMap _map176 = iprot.readMapBegin(); + struct.value_types = new HashMap(2*_map176.size); + for (int _i177 = 0; _i177 < _map176.size; ++_i177) { - ByteBuffer _key180; // required - String _val181; // required - _key180 = iprot.readBinary(); - _val181 = iprot.readString(); - struct.value_types.put(_key180, _val181); + ByteBuffer _key178; // optional + String _val179; // required + _key178 = iprot.readBinary(); + _val179 = iprot.readString(); + struct.value_types.put(_key178, _val179); } iprot.readMapEnd(); } @@ -730,10 +730,10 @@ public class CqlMetadata implements org.apache.thrift.TBase _iter182 : struct.name_types.entrySet()) + for (Map.Entry _iter180 : struct.name_types.entrySet()) { - oprot.writeBinary(_iter182.getKey()); - oprot.writeString(_iter182.getValue()); + oprot.writeBinary(_iter180.getKey()); + oprot.writeString(_iter180.getValue()); } oprot.writeMapEnd(); } @@ -743,10 +743,10 @@ public class CqlMetadata implements org.apache.thrift.TBase _iter183 : struct.value_types.entrySet()) + for (Map.Entry _iter181 : struct.value_types.entrySet()) { - oprot.writeBinary(_iter183.getKey()); - oprot.writeString(_iter183.getValue()); + oprot.writeBinary(_iter181.getKey()); + oprot.writeString(_iter181.getValue()); } oprot.writeMapEnd(); } @@ -781,18 +781,18 @@ public class CqlMetadata implements org.apache.thrift.TBase _iter184 : struct.name_types.entrySet()) + for (Map.Entry _iter182 : struct.name_types.entrySet()) { - oprot.writeBinary(_iter184.getKey()); - oprot.writeString(_iter184.getValue()); + oprot.writeBinary(_iter182.getKey()); + oprot.writeString(_iter182.getValue()); } } { oprot.writeI32(struct.value_types.size()); - for (Map.Entry _iter185 : struct.value_types.entrySet()) + for (Map.Entry _iter183 : struct.value_types.entrySet()) { - oprot.writeBinary(_iter185.getKey()); - oprot.writeString(_iter185.getValue()); + oprot.writeBinary(_iter183.getKey()); + oprot.writeString(_iter183.getValue()); } } oprot.writeString(struct.default_name_type); @@ -803,28 +803,28 @@ public class CqlMetadata implements org.apache.thrift.TBase(2*_map186.size); - for (int _i187 = 0; _i187 < _map186.size; ++_i187) + org.apache.thrift.protocol.TMap _map184 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.name_types = new HashMap(2*_map184.size); + for (int _i185 = 0; _i185 < _map184.size; ++_i185) { - ByteBuffer _key188; // required - String _val189; // required - _key188 = iprot.readBinary(); - _val189 = iprot.readString(); - struct.name_types.put(_key188, _val189); + ByteBuffer _key186; // optional + String _val187; // required + _key186 = iprot.readBinary(); + _val187 = iprot.readString(); + struct.name_types.put(_key186, _val187); } } struct.setName_typesIsSet(true); { - org.apache.thrift.protocol.TMap _map190 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.value_types = new HashMap(2*_map190.size); - for (int _i191 = 0; _i191 < _map190.size; ++_i191) + org.apache.thrift.protocol.TMap _map188 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.value_types = new HashMap(2*_map188.size); + for (int _i189 = 0; _i189 < _map188.size; ++_i189) { - ByteBuffer _key192; // required - String _val193; // required - _key192 = iprot.readBinary(); - _val193 = iprot.readString(); - struct.value_types.put(_key192, _val193); + ByteBuffer _key190; // optional + String _val191; // required + _key190 = iprot.readBinary(); + _val191 = iprot.readString(); + struct.value_types.put(_key190, _val191); } } struct.setValue_typesIsSet(true); diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlPreparedResult.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlPreparedResult.java index bd3b48438d..3c03d1f17f 100644 --- a/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlPreparedResult.java +++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlPreparedResult.java @@ -649,13 +649,13 @@ public class CqlPreparedResult implements org.apache.thrift.TBase(_list202.size); - for (int _i203 = 0; _i203 < _list202.size; ++_i203) + org.apache.thrift.protocol.TList _list200 = iprot.readListBegin(); + struct.variable_types = new ArrayList(_list200.size); + for (int _i201 = 0; _i201 < _list200.size; ++_i201) { - String _elem204; // required - _elem204 = iprot.readString(); - struct.variable_types.add(_elem204); + String _elem202; // required + _elem202 = iprot.readString(); + struct.variable_types.add(_elem202); } iprot.readListEnd(); } @@ -667,13 +667,13 @@ public class CqlPreparedResult implements org.apache.thrift.TBase(_list205.size); - for (int _i206 = 0; _i206 < _list205.size; ++_i206) + org.apache.thrift.protocol.TList _list203 = iprot.readListBegin(); + struct.variable_names = new ArrayList(_list203.size); + for (int _i204 = 0; _i204 < _list203.size; ++_i204) { - String _elem207; // required - _elem207 = iprot.readString(); - struct.variable_names.add(_elem207); + String _elem205; // required + _elem205 = iprot.readString(); + struct.variable_names.add(_elem205); } iprot.readListEnd(); } @@ -714,9 +714,9 @@ public class CqlPreparedResult implements org.apache.thrift.TBase(_list212.size); - for (int _i213 = 0; _i213 < _list212.size; ++_i213) + org.apache.thrift.protocol.TList _list210 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.variable_types = new ArrayList(_list210.size); + for (int _i211 = 0; _i211 < _list210.size; ++_i211) { - String _elem214; // required - _elem214 = iprot.readString(); - struct.variable_types.add(_elem214); + String _elem212; // required + _elem212 = iprot.readString(); + struct.variable_types.add(_elem212); } } struct.setVariable_typesIsSet(true); } if (incoming.get(1)) { { - org.apache.thrift.protocol.TList _list215 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.variable_names = new ArrayList(_list215.size); - for (int _i216 = 0; _i216 < _list215.size; ++_i216) + org.apache.thrift.protocol.TList _list213 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.variable_names = new ArrayList(_list213.size); + for (int _i214 = 0; _i214 < _list213.size; ++_i214) { - String _elem217; // required - _elem217 = iprot.readString(); - struct.variable_names.add(_elem217); + String _elem215; // required + _elem215 = iprot.readString(); + struct.variable_names.add(_elem215); } } struct.setVariable_namesIsSet(true); diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlResult.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlResult.java index 42960971a0..86bca202e4 100644 --- a/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlResult.java +++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlResult.java @@ -644,14 +644,14 @@ public class CqlResult implements org.apache.thrift.TBase(_list194.size); - for (int _i195 = 0; _i195 < _list194.size; ++_i195) + org.apache.thrift.protocol.TList _list192 = iprot.readListBegin(); + struct.rows = new ArrayList(_list192.size); + for (int _i193 = 0; _i193 < _list192.size; ++_i193) { - CqlRow _elem196; // required - _elem196 = new CqlRow(); - _elem196.read(iprot); - struct.rows.add(_elem196); + CqlRow _elem194; // required + _elem194 = new CqlRow(); + _elem194.read(iprot); + struct.rows.add(_elem194); } iprot.readListEnd(); } @@ -702,9 +702,9 @@ public class CqlResult implements org.apache.thrift.TBase(_list199.size); - for (int _i200 = 0; _i200 < _list199.size; ++_i200) + org.apache.thrift.protocol.TList _list197 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.rows = new ArrayList(_list197.size); + for (int _i198 = 0; _i198 < _list197.size; ++_i198) { - CqlRow _elem201; // required - _elem201 = new CqlRow(); - _elem201.read(iprot); - struct.rows.add(_elem201); + CqlRow _elem199; // required + _elem199 = new CqlRow(); + _elem199.read(iprot); + struct.rows.add(_elem199); } } struct.setRowsIsSet(true); diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlRow.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlRow.java index a01d324578..fd781ef619 100644 --- a/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlRow.java +++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlRow.java @@ -478,14 +478,14 @@ public class CqlRow implements org.apache.thrift.TBase, case 2: // COLUMNS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list166 = iprot.readListBegin(); - struct.columns = new ArrayList(_list166.size); - for (int _i167 = 0; _i167 < _list166.size; ++_i167) + org.apache.thrift.protocol.TList _list164 = iprot.readListBegin(); + struct.columns = new ArrayList(_list164.size); + for (int _i165 = 0; _i165 < _list164.size; ++_i165) { - Column _elem168; // required - _elem168 = new Column(); - _elem168.read(iprot); - struct.columns.add(_elem168); + Column _elem166; // required + _elem166 = new Column(); + _elem166.read(iprot); + struct.columns.add(_elem166); } iprot.readListEnd(); } @@ -518,9 +518,9 @@ public class CqlRow implements org.apache.thrift.TBase, oprot.writeFieldBegin(COLUMNS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.columns.size())); - for (Column _iter169 : struct.columns) + for (Column _iter167 : struct.columns) { - _iter169.write(oprot); + _iter167.write(oprot); } oprot.writeListEnd(); } @@ -546,9 +546,9 @@ public class CqlRow implements org.apache.thrift.TBase, oprot.writeBinary(struct.key); { oprot.writeI32(struct.columns.size()); - for (Column _iter170 : struct.columns) + for (Column _iter168 : struct.columns) { - _iter170.write(oprot); + _iter168.write(oprot); } } } @@ -559,14 +559,14 @@ public class CqlRow implements org.apache.thrift.TBase, struct.key = iprot.readBinary(); struct.setKeyIsSet(true); { - org.apache.thrift.protocol.TList _list171 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.columns = new ArrayList(_list171.size); - for (int _i172 = 0; _i172 < _list171.size; ++_i172) + org.apache.thrift.protocol.TList _list169 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.columns = new ArrayList(_list169.size); + for (int _i170 = 0; _i170 < _list169.size; ++_i170) { - Column _elem173; // required - _elem173 = new Column(); - _elem173.read(iprot); - struct.columns.add(_elem173); + Column _elem171; // required + _elem171 = new Column(); + _elem171.read(iprot); + struct.columns.add(_elem171); } } struct.setColumnsIsSet(true); 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 fa9de9d2c2..679f270bb2 100644 --- a/interface/thrift/gen-java/org/apache/cassandra/thrift/KsDef.java +++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/KsDef.java @@ -837,15 +837,15 @@ public class KsDef implements org.apache.thrift.TBase, jav case 3: // STRATEGY_OPTIONS if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map148 = iprot.readMapBegin(); - struct.strategy_options = new HashMap(2*_map148.size); - for (int _i149 = 0; _i149 < _map148.size; ++_i149) + org.apache.thrift.protocol.TMap _map146 = iprot.readMapBegin(); + struct.strategy_options = new HashMap(2*_map146.size); + for (int _i147 = 0; _i147 < _map146.size; ++_i147) { - String _key150; // required - String _val151; // required - _key150 = iprot.readString(); - _val151 = iprot.readString(); - struct.strategy_options.put(_key150, _val151); + String _key148; // optional + String _val149; // required + _key148 = iprot.readString(); + _val149 = iprot.readString(); + struct.strategy_options.put(_key148, _val149); } iprot.readMapEnd(); } @@ -865,14 +865,14 @@ public class KsDef implements org.apache.thrift.TBase, jav case 5: // CF_DEFS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list152 = iprot.readListBegin(); - struct.cf_defs = new ArrayList(_list152.size); - for (int _i153 = 0; _i153 < _list152.size; ++_i153) + org.apache.thrift.protocol.TList _list150 = iprot.readListBegin(); + struct.cf_defs = new ArrayList(_list150.size); + for (int _i151 = 0; _i151 < _list150.size; ++_i151) { - CfDef _elem154; // required - _elem154 = new CfDef(); - _elem154.read(iprot); - struct.cf_defs.add(_elem154); + CfDef _elem152; // required + _elem152 = new CfDef(); + _elem152.read(iprot); + struct.cf_defs.add(_elem152); } iprot.readListEnd(); } @@ -919,10 +919,10 @@ public class KsDef implements org.apache.thrift.TBase, jav oprot.writeFieldBegin(STRATEGY_OPTIONS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.strategy_options.size())); - for (Map.Entry _iter155 : struct.strategy_options.entrySet()) + for (Map.Entry _iter153 : struct.strategy_options.entrySet()) { - oprot.writeString(_iter155.getKey()); - oprot.writeString(_iter155.getValue()); + oprot.writeString(_iter153.getKey()); + oprot.writeString(_iter153.getValue()); } oprot.writeMapEnd(); } @@ -938,9 +938,9 @@ public class KsDef implements org.apache.thrift.TBase, jav oprot.writeFieldBegin(CF_DEFS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.cf_defs.size())); - for (CfDef _iter156 : struct.cf_defs) + for (CfDef _iter154 : struct.cf_defs) { - _iter156.write(oprot); + _iter154.write(oprot); } oprot.writeListEnd(); } @@ -972,9 +972,9 @@ public class KsDef implements org.apache.thrift.TBase, jav oprot.writeString(struct.strategy_class); { oprot.writeI32(struct.cf_defs.size()); - for (CfDef _iter157 : struct.cf_defs) + for (CfDef _iter155 : struct.cf_defs) { - _iter157.write(oprot); + _iter155.write(oprot); } } BitSet optionals = new BitSet(); @@ -991,10 +991,10 @@ public class KsDef implements org.apache.thrift.TBase, jav if (struct.isSetStrategy_options()) { { oprot.writeI32(struct.strategy_options.size()); - for (Map.Entry _iter158 : struct.strategy_options.entrySet()) + for (Map.Entry _iter156 : struct.strategy_options.entrySet()) { - oprot.writeString(_iter158.getKey()); - oprot.writeString(_iter158.getValue()); + oprot.writeString(_iter156.getKey()); + oprot.writeString(_iter156.getValue()); } } } @@ -1014,29 +1014,29 @@ public class KsDef implements org.apache.thrift.TBase, jav struct.strategy_class = iprot.readString(); struct.setStrategy_classIsSet(true); { - org.apache.thrift.protocol.TList _list159 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.cf_defs = new ArrayList(_list159.size); - for (int _i160 = 0; _i160 < _list159.size; ++_i160) + org.apache.thrift.protocol.TList _list157 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.cf_defs = new ArrayList(_list157.size); + for (int _i158 = 0; _i158 < _list157.size; ++_i158) { - CfDef _elem161; // required - _elem161 = new CfDef(); - _elem161.read(iprot); - struct.cf_defs.add(_elem161); + CfDef _elem159; // required + _elem159 = new CfDef(); + _elem159.read(iprot); + struct.cf_defs.add(_elem159); } } struct.setCf_defsIsSet(true); BitSet incoming = iprot.readBitSet(3); if (incoming.get(0)) { { - org.apache.thrift.protocol.TMap _map162 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.strategy_options = new HashMap(2*_map162.size); - for (int _i163 = 0; _i163 < _map162.size; ++_i163) + org.apache.thrift.protocol.TMap _map160 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.strategy_options = new HashMap(2*_map160.size); + for (int _i161 = 0; _i161 < _map160.size; ++_i161) { - String _key164; // required - String _val165; // required - _key164 = iprot.readString(); - _val165 = iprot.readString(); - struct.strategy_options.put(_key164, _val165); + String _key162; // optional + String _val163; // required + _key162 = iprot.readString(); + _val163 = iprot.readString(); + struct.strategy_options.put(_key162, _val163); } } struct.setStrategy_optionsIsSet(true); diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/TriggerDef.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/TriggerDef.java new file mode 100644 index 0000000000..398281b177 --- /dev/null +++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/TriggerDef.java @@ -0,0 +1,577 @@ +/** + * Autogenerated by Thrift Compiler (0.9.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.cassandra.thrift; +/* + * + * 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 org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Describes a trigger. + * `options` should include at least 'class' param. + * Other options are not supported yet. + */ +public class TriggerDef implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TriggerDef"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField OPTIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("options", org.apache.thrift.protocol.TType.MAP, (short)2); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new TriggerDefStandardSchemeFactory()); + schemes.put(TupleScheme.class, new TriggerDefTupleSchemeFactory()); + } + + public String name; // required + public Map options; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short)1, "name"), + OPTIONS((short)2, "options"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // NAME + return NAME; + case 2: // OPTIONS + return OPTIONS; + default: + return null; + } + } + + /** + * 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, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.OPTIONS, new org.apache.thrift.meta_data.FieldMetaData("options", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TriggerDef.class, metaDataMap); + } + + public TriggerDef() { + } + + public TriggerDef( + String name, + Map options) + { + this(); + this.name = name; + this.options = options; + } + + /** + * Performs a deep copy on other. + */ + public TriggerDef(TriggerDef other) { + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetOptions()) { + Map __this__options = new HashMap(); + for (Map.Entry other_element : other.options.entrySet()) { + + String other_element_key = other_element.getKey(); + String other_element_value = other_element.getValue(); + + String __this__options_copy_key = other_element_key; + + String __this__options_copy_value = other_element_value; + + __this__options.put(__this__options_copy_key, __this__options_copy_value); + } + this.options = __this__options; + } + } + + public TriggerDef deepCopy() { + return new TriggerDef(this); + } + + @Override + public void clear() { + this.name = null; + this.options = null; + } + + public String getName() { + return this.name; + } + + public TriggerDef setName(String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public int getOptionsSize() { + return (this.options == null) ? 0 : this.options.size(); + } + + public void putToOptions(String key, String val) { + if (this.options == null) { + this.options = new HashMap(); + } + this.options.put(key, val); + } + + public Map getOptions() { + return this.options; + } + + public TriggerDef setOptions(Map options) { + this.options = options; + return this; + } + + public void unsetOptions() { + this.options = null; + } + + /** Returns true if field options is set (has been assigned a value) and false otherwise */ + public boolean isSetOptions() { + return this.options != null; + } + + public void setOptionsIsSet(boolean value) { + if (!value) { + this.options = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String)value); + } + break; + + case OPTIONS: + if (value == null) { + unsetOptions(); + } else { + setOptions((Map)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case OPTIONS: + return getOptions(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case OPTIONS: + return isSetOptions(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof TriggerDef) + return this.equals((TriggerDef)that); + return false; + } + + public boolean equals(TriggerDef that) { + if (that == null) + return false; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) + return false; + if (!this.name.equals(that.name)) + return false; + } + + boolean this_present_options = true && this.isSetOptions(); + boolean that_present_options = true && that.isSetOptions(); + if (this_present_options || that_present_options) { + if (!(this_present_options && that_present_options)) + return false; + if (!this.options.equals(that.options)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + HashCodeBuilder builder = new HashCodeBuilder(); + + boolean present_name = true && (isSetName()); + builder.append(present_name); + if (present_name) + builder.append(name); + + boolean present_options = true && (isSetOptions()); + builder.append(present_options); + if (present_options) + builder.append(options); + + return builder.toHashCode(); + } + + public int compareTo(TriggerDef other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + TriggerDef typedOther = (TriggerDef)other; + + lastComparison = Boolean.valueOf(isSetName()).compareTo(typedOther.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, typedOther.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetOptions()).compareTo(typedOther.isSetOptions()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetOptions()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.options, typedOther.options); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("TriggerDef("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("options:"); + if (this.options == null) { + sb.append("null"); + } else { + sb.append(this.options); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (name == null) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'name' was not present! Struct: " + toString()); + } + if (options == null) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'options' was not present! Struct: " + toString()); + } + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class TriggerDefStandardSchemeFactory implements SchemeFactory { + public TriggerDefStandardScheme getScheme() { + return new TriggerDefStandardScheme(); + } + } + + private static class TriggerDefStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, TriggerDef struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // OPTIONS + if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { + { + org.apache.thrift.protocol.TMap _map100 = iprot.readMapBegin(); + struct.options = new HashMap(2*_map100.size); + for (int _i101 = 0; _i101 < _map100.size; ++_i101) + { + String _key102; // optional + String _val103; // required + _key102 = iprot.readString(); + _val103 = iprot.readString(); + struct.options.put(_key102, _val103); + } + iprot.readMapEnd(); + } + struct.setOptionsIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, TriggerDef struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.options != null) { + oprot.writeFieldBegin(OPTIONS_FIELD_DESC); + { + oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.options.size())); + for (Map.Entry _iter104 : struct.options.entrySet()) + { + oprot.writeString(_iter104.getKey()); + oprot.writeString(_iter104.getValue()); + } + oprot.writeMapEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class TriggerDefTupleSchemeFactory implements SchemeFactory { + public TriggerDefTupleScheme getScheme() { + return new TriggerDefTupleScheme(); + } + } + + private static class TriggerDefTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, TriggerDef struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.name); + { + oprot.writeI32(struct.options.size()); + for (Map.Entry _iter105 : struct.options.entrySet()) + { + oprot.writeString(_iter105.getKey()); + oprot.writeString(_iter105.getValue()); + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, TriggerDef struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.name = iprot.readString(); + struct.setNameIsSet(true); + { + org.apache.thrift.protocol.TMap _map106 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.options = new HashMap(2*_map106.size); + for (int _i107 = 0; _i107 < _map106.size; ++_i107) + { + String _key108; // optional + String _val109; // required + _key108 = iprot.readString(); + _val109 = iprot.readString(); + struct.options.put(_key108, _val109); + } + } + struct.setOptionsIsSet(true); + } + } + +} + diff --git a/src/java/org/apache/cassandra/config/CFMetaData.java b/src/java/org/apache/cassandra/config/CFMetaData.java index 9ab24fb682..9d18c6cb1c 100644 --- a/src/java/org/apache/cassandra/config/CFMetaData.java +++ b/src/java/org/apache/cassandra/config/CFMetaData.java @@ -24,13 +24,11 @@ import java.lang.reflect.Method; import java.nio.ByteBuffer; import java.nio.charset.CharacterCodingException; import java.util.*; -import java.util.Map.Entry; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Objects; import com.google.common.collect.MapDifference; import com.google.common.collect.Maps; - import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.builder.EqualsBuilder; @@ -373,8 +371,7 @@ public final class CFMetaData private volatile SpeculativeRetry speculativeRetry = DEFAULT_SPECULATIVE_RETRY; private volatile boolean populateIoCacheOnFlush = DEFAULT_POPULATE_IO_CACHE_ON_FLUSH; private volatile Map droppedColumns = new HashMap<>(); - private volatile Map> triggers = new HashMap<>(); - private volatile Collection cachedTriggers; + private volatile Map triggers = new HashMap<>(); /* * All CQL3 columns definition are stored in the column_metadata map. @@ -424,7 +421,7 @@ public final class CFMetaData public CFMetaData speculativeRetry(SpeculativeRetry prop) {speculativeRetry = prop; return this;} public CFMetaData populateIoCacheOnFlush(boolean prop) {populateIoCacheOnFlush = prop; return this;} public CFMetaData droppedColumns(Map cols) {droppedColumns = cols; return this;} - public CFMetaData triggers(Map> prop) {triggers = prop; cachedTriggers = TriggerOptions.extractClasses(triggers); return this;} + public CFMetaData triggers(Map prop) {triggers = prop; return this;} public CFMetaData(String keyspace, String name, ColumnFamilyType type, AbstractType comp, AbstractType subcc) { @@ -447,9 +444,9 @@ public final class CFMetaData cfId = id; } - public Map> getTriggers() + public Map getTriggers() { - return new HashMap<>(triggers); + return triggers; } private static CFMetaData compile(String cql) @@ -515,7 +512,6 @@ public final class CFMetaData .gcGraceSeconds(0) .caching(indexCaching) .speculativeRetry(parent.speculativeRetry) - .triggers(parent.triggers) .compactionStrategyClass(parent.compactionStrategyClass) .compactionStrategyOptions(parent.compactionStrategyOptions) .reloadSecondaryIndexMetadata(parent) @@ -713,11 +709,6 @@ public final class CFMetaData : bloomFilterFpChance; } - public Collection getTriggerClasses() - { - return cachedTriggers; - } - public Caching getCaching() { return caching; @@ -911,7 +902,7 @@ public final class CFMetaData if (cf_def.isSetPopulate_io_cache_on_flush()) newCFMD.populateIoCacheOnFlush(cf_def.populate_io_cache_on_flush); if (cf_def.isSetTriggers()) - newCFMD.triggers(cf_def.triggers); + newCFMD.triggers(TriggerDefinition.fromThrift(cf_def.triggers)); CompressionParameters cp = CompressionParameters.create(cf_def.compression_options); @@ -954,12 +945,12 @@ public final class CFMetaData } catch (CharacterCodingException ignore) {} UntypedResultSet.Row cql3row = new UntypedResultSet.Row(columns); - return fromSchemaNoColumns(cql3row); + return fromSchemaNoColumnsNoTriggers(cql3row); } public void reload() { - Row cfDefRow = SystemKeyspace.readSchemaRow(ksName, cfName); + Row cfDefRow = SystemKeyspace.readSchemaRow(SystemKeyspace.SCHEMA_COLUMNFAMILIES_CF, ksName, cfName); if (cfDefRow.cf == null || cfDefRow.cf.getColumnCount() == 0) throw new RuntimeException(String.format("%s not found in the schema definitions keyspace.", ksName + ":" + cfName)); @@ -1030,11 +1021,12 @@ public final class CFMetaData oldDef.apply(def, getColumnDefinitionComparator(oldDef)); } - triggers(new HashMap<>(cfm.triggers)); // update trigger as an unit. compactionStrategyClass = cfm.compactionStrategyClass; compactionStrategyOptions = cfm.compactionStrategyOptions; - compressionParameters = cfm.compressionParameters(); + compressionParameters = cfm.compressionParameters; + + triggers = cfm.triggers; rebuild(); logger.debug("application result is {}", this); @@ -1156,13 +1148,7 @@ public final class CFMetaData // We only return the alias if only one is set since thrift don't know about multiple key aliases if (partitionKeyColumns.size() == 1) def.setKey_alias(partitionKeyColumns.get(0).name); - List column_meta = new ArrayList(column_metadata.size()); - for (ColumnDefinition cd : column_metadata.values()) - { - if (cd.type == ColumnDefinition.Type.REGULAR) - column_meta.add(cd.toThrift()); - } - def.setColumn_metadata(column_meta); + def.setColumn_metadata(ColumnDefinition.toThrift(column_metadata)); def.setCompaction_strategy(compactionStrategyClass.getName()); def.setCompaction_strategy_options(new HashMap(compactionStrategyOptions)); def.setCompression_options(compressionParameters.asThriftOptions()); @@ -1173,7 +1159,8 @@ public final class CFMetaData def.setCaching(caching.toString()); def.setDefault_time_to_live(defaultTimeToLive); def.setSpeculative_retry(speculativeRetry.toString()); - def.setTriggers(triggers); + def.setTriggers(TriggerDefinition.toThrift(triggers)); + return def; } @@ -1438,7 +1425,7 @@ public final class CFMetaData { RowMutation rm = new RowMutation(Keyspace.SYSTEM_KS, SystemKeyspace.getSchemaKSKey(ksName)); - newState.toSchemaNoColumns(rm, modificationTimestamp); + newState.toSchemaNoColumnsNoTriggers(rm, modificationTimestamp); MapDifference columnDiff = Maps.difference(column_metadata, newState.column_metadata); @@ -1464,11 +1451,15 @@ public final class CFMetaData cd.toSchema(rm, cfName, getColumnDefinitionComparator(cd), modificationTimestamp); } - MapDifference> tdiffrence = Maps.difference(triggers, newState.triggers); - for (Entry> tentry : tdiffrence.entriesOnlyOnLeft().entrySet()) - TriggerOptions.deleteColumns(rm, cfName, tentry, modificationTimestamp); - for (Entry> tentry : tdiffrence.entriesOnlyOnRight().entrySet()) - TriggerOptions.addColumns(rm, cfName, tentry, modificationTimestamp); + MapDifference triggerDiff = Maps.difference(triggers, newState.triggers); + + // dropped triggers + for (TriggerDefinition td : triggerDiff.entriesOnlyOnLeft().values()) + td.deleteFromSchema(rm, cfName, modificationTimestamp); + + // newly created triggers + for (TriggerDefinition td : triggerDiff.entriesOnlyOnRight().values()) + td.toSchema(rm, cfName, modificationTimestamp); return rm; } @@ -1490,26 +1481,24 @@ public final class CFMetaData builder.add(ByteBufferUtil.bytes(cfName)); cf.addAtom(new RangeTombstone(builder.build(), builder.buildAsEndOfRange(), timestamp, ldt)); - ColumnFamily tcf = rm.addOrGet(SchemaTriggersCf); - ColumnNameBuilder tbuilder = SchemaTriggersCf.getCfDef().getColumnNameBuilder(); - tbuilder.add(ByteBufferUtil.bytes(cfName)); - tcf.addAtom(new RangeTombstone(tbuilder.build(), tbuilder.buildAsEndOfRange(), timestamp, ldt)); - for (ColumnDefinition cd : column_metadata.values()) cd.deleteFromSchema(rm, cfName, timestamp); + for (TriggerDefinition td : triggers.values()) + td.deleteFromSchema(rm, cfName, timestamp); + return rm; } public void toSchema(RowMutation rm, long timestamp) { - toSchemaNoColumns(rm, timestamp); + toSchemaNoColumnsNoTriggers(rm, timestamp); for (ColumnDefinition cd : column_metadata.values()) cd.toSchema(rm, cfName, getColumnDefinitionComparator(cd), timestamp); } - private void toSchemaNoColumns(RowMutation rm, long timestamp) + private void toSchemaNoColumnsNoTriggers(RowMutation rm, long timestamp) { // For property that can be null (and can be changed), we insert tombstones, to make sure // we don't keep a property the user has removed @@ -1566,7 +1555,7 @@ public final class CFMetaData } // Package protected for use by tests - static CFMetaData fromSchemaNoColumns(UntypedResultSet.Row result) + static CFMetaData fromSchemaNoColumnsNoTriggers(UntypedResultSet.Row result) { try { @@ -1664,13 +1653,13 @@ public final class CFMetaData */ public static CFMetaData fromSchema(UntypedResultSet.Row result) { - CFMetaData cfDef = fromSchemaNoColumns(result); + CFMetaData cfDef = fromSchemaNoColumnsNoTriggers(result); - // read triggers. - cfDef.triggers(TriggerOptions.getAllTriggers(cfDef.ksName, cfDef.cfName)); + Row serializedTriggers = SystemKeyspace.readSchemaRow(SystemKeyspace.SCHEMA_TRIGGERS_CF, cfDef.ksName, cfDef.cfName); + addTriggerDefinitionsFromSchema(cfDef, serializedTriggers); - Row serializedColumnDefinitions = ColumnDefinition.readSchema(cfDef.ksName, cfDef.cfName); - return addColumnDefinitionSchema(cfDef, serializedColumnDefinitions); + Row serializedColumns = SystemKeyspace.readSchemaRow(SystemKeyspace.SCHEMA_COLUMNS_CF, cfDef.ksName, cfDef.cfName); + return addColumnDefinitionsFromSchema(cfDef, serializedColumns); } private static CFMetaData fromSchema(Row row) @@ -1761,7 +1750,7 @@ public final class CFMetaData } // Package protected for use by tests - static CFMetaData addColumnDefinitionSchema(CFMetaData cfDef, Row serializedColumnDefinitions) + static CFMetaData addColumnDefinitionsFromSchema(CFMetaData cfDef, Row serializedColumnDefinitions) { for (ColumnDefinition cd : ColumnDefinition.fromSchema(serializedColumnDefinitions, cfDef)) cfDef.column_metadata.put(cd.name, cd); @@ -1788,6 +1777,24 @@ public final class CFMetaData return column_metadata.remove(def.name) != null; } + private static void addTriggerDefinitionsFromSchema(CFMetaData cfDef, Row serializedTriggerDefinitions) + { + for (TriggerDefinition td : TriggerDefinition.fromSchema(serializedTriggerDefinitions)) + cfDef.triggers.put(td.name, td); + } + + public void addTriggerDefinition(TriggerDefinition def) throws ConfigurationException + { + if (triggers.containsKey(def.name)) + throw new ConfigurationException(String.format("Cannot create trigger %s, a trigger with the same name already exists", def.name)); + triggers.put(def.name, def); + } + + public boolean removeTrigger(String name) + { + return triggers.remove(name) != null; + } + public void recordColumnDrop(ColumnDefinition def) { assert def.componentIndex != null; diff --git a/src/java/org/apache/cassandra/config/ColumnDefinition.java b/src/java/org/apache/cassandra/config/ColumnDefinition.java index 2959f183f7..2b8465e80a 100644 --- a/src/java/org/apache/cassandra/config/ColumnDefinition.java +++ b/src/java/org/apache/cassandra/config/ColumnDefinition.java @@ -148,6 +148,15 @@ public class ColumnDefinition return type == ColumnDefinition.Type.REGULAR && componentIndex == null; } + public static List toThrift(Map columns) + { + List thriftDefs = new ArrayList<>(columns.size()); + for (ColumnDefinition def : columns.values()) + if (def.type == ColumnDefinition.Type.REGULAR) + thriftDefs.add(def.toThrift()); + return thriftDefs; + } + public ColumnDef toThrift() { ColumnDef cd = new ColumnDef(); diff --git a/src/java/org/apache/cassandra/config/KSMetaData.java b/src/java/org/apache/cassandra/config/KSMetaData.java index cf14e586d0..3cfa04bd17 100644 --- a/src/java/org/apache/cassandra/config/KSMetaData.java +++ b/src/java/org/apache/cassandra/config/KSMetaData.java @@ -308,13 +308,11 @@ public final class KSMetaData for (CFMetaData cfm : cfms.values()) { - Row columnRow = ColumnDefinition.readSchema(cfm.ksName, cfm.cfName); + Row columnRow = SystemKeyspace.readSchemaRow(SystemKeyspace.SCHEMA_COLUMNS_CF, cfm.ksName, cfm.cfName); + // This may replace some existing definition coming from the old key, column and + // value aliases. But that's what we want (see CFMetaData.fromSchemaNoColumnsNoTriggers). for (ColumnDefinition cd : ColumnDefinition.fromSchema(columnRow, cfm)) - { - // This may replace some existing definition coming from the old key, column and - // value aliases. But that's what we want (see CFMetaData.fromSchemaNoColumns). cfm.addOrReplaceColumnDefinition(cd); - } cfm.rebuild(); } diff --git a/src/java/org/apache/cassandra/config/TriggerDefinition.java b/src/java/org/apache/cassandra/config/TriggerDefinition.java new file mode 100644 index 0000000000..699c163b91 --- /dev/null +++ b/src/java/org/apache/cassandra/config/TriggerDefinition.java @@ -0,0 +1,166 @@ +/* + * 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. + */ +package org.apache.cassandra.config; + +import java.util.*; + +import com.google.common.base.Objects; + +import org.apache.cassandra.cql3.ColumnNameBuilder; +import org.apache.cassandra.cql3.QueryProcessor; +import org.apache.cassandra.cql3.UntypedResultSet; +import org.apache.cassandra.db.*; +import org.apache.cassandra.db.marshal.UTF8Type; +import org.apache.cassandra.thrift.TriggerDef; + +import static org.apache.cassandra.utils.ByteBufferUtil.bytes; + +public class TriggerDefinition +{ + private static final String TRIGGER_NAME = "trigger_name"; + private static final String TRIGGER_OPTIONS = "trigger_options"; + private static final String CLASS = "class"; + + public final String name; + + // For now, the only supported option is 'class'. + // Proper trigger parametrization will be added later. + public final String classOption; + + TriggerDefinition(String name, String classOption) + { + this.name = name; + this.classOption = classOption; + } + + public static TriggerDefinition create(String name, String classOption) + { + return new TriggerDefinition(name, classOption); + } + + /** + * Deserialize triggers from storage-level representation. + * + * @param serializedTriggers storage-level partition containing the trigger definitions + * @return the list of processed TriggerDefinitions + */ + public static List fromSchema(Row serializedTriggers) + { + List triggers = new ArrayList<>(); + String query = String.format("SELECT * FROM %s.%s", Keyspace.SYSTEM_KS, SystemKeyspace.SCHEMA_TRIGGERS_CF); + for (UntypedResultSet.Row row : QueryProcessor.resultify(query, serializedTriggers)) + { + String name = row.getString(TRIGGER_NAME); + String classOption = row.getMap(TRIGGER_OPTIONS, UTF8Type.instance, UTF8Type.instance).get(CLASS); + triggers.add(new TriggerDefinition(name, classOption)); + } + return triggers; + } + + /** + * Add specified trigger to the schema using given row. + * + * @param rm The schema row mutation + * @param cfName The name of the parent ColumnFamily + * @param timestamp The timestamp to use for the columns + */ + public void toSchema(RowMutation rm, String cfName, long timestamp) + { + ColumnFamily cf = rm.addOrGet(SystemKeyspace.SCHEMA_TRIGGERS_CF); + + ColumnNameBuilder builder = CFMetaData.SchemaTriggersCf.getCfDef().getColumnNameBuilder(); + builder.add(bytes(cfName)).add(bytes(name)); + + cf.addColumn(builder.copy().add(bytes("")).build(), bytes(""), timestamp); // the row marker + cf.addColumn(builder.copy().add(bytes(TRIGGER_OPTIONS)).add(bytes(CLASS)).build(), bytes(classOption), timestamp); + } + + /** + * Drop specified trigger from the schema using given row. + * + * @param rm The schema row mutation + * @param cfName The name of the parent ColumnFamily + * @param timestamp The timestamp to use for the tombstone + */ + public void deleteFromSchema(RowMutation rm, String cfName, long timestamp) + { + ColumnFamily cf = rm.addOrGet(SystemKeyspace.SCHEMA_TRIGGERS_CF); + int ldt = (int) (System.currentTimeMillis() / 1000); + + ColumnNameBuilder builder = CFMetaData.SchemaTriggersCf.getCfDef().getColumnNameBuilder(); + builder.add(bytes(cfName)).add(bytes(name)); + cf.addAtom(new RangeTombstone(builder.build(), builder.buildAsEndOfRange(), timestamp, ldt)); + } + + public static TriggerDefinition fromThrift(TriggerDef thriftDef) + { + return new TriggerDefinition(thriftDef.getName(), thriftDef.getOptions().get(CLASS)); + } + + public TriggerDef toThrift() + { + TriggerDef td = new TriggerDef(); + td.setName(name); + td.setOptions(Collections.singletonMap(CLASS, classOption)); + return td; + } + + public static Map fromThrift(List thriftDefs) + { + Map triggerDefinitions = new HashMap<>(); + for (TriggerDef thriftDef : thriftDefs) + triggerDefinitions.put(thriftDef.getName(), fromThrift(thriftDef)); + return triggerDefinitions; + } + + public static List toThrift(Map triggers) + { + List thriftDefs = new ArrayList<>(triggers.size()); + for (TriggerDefinition def : triggers.values()) + thriftDefs.add(def.toThrift()); + return thriftDefs; + } + + @Override + public boolean equals(Object o) + { + if (this == o) + return true; + + if (!(o instanceof TriggerDefinition)) + return false; + + TriggerDefinition td = (TriggerDefinition) o; + + return Objects.equal(this.name, td.name) + && Objects.equal(this.classOption, td.classOption); + } + + @Override + public int hashCode() + { + return Objects.hashCode(name, classOption); + } + + @Override + public String toString() + { + return Objects.toStringHelper(this).add("name", name).add("classOption", classOption).toString(); + } +} diff --git a/src/java/org/apache/cassandra/config/TriggerOptions.java b/src/java/org/apache/cassandra/config/TriggerOptions.java deleted file mode 100644 index 339ee24981..0000000000 --- a/src/java/org/apache/cassandra/config/TriggerOptions.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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. - */ -package org.apache.cassandra.config; - -import static org.apache.cassandra.cql3.QueryProcessor.processInternal; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.apache.cassandra.cql3.ColumnNameBuilder; -import org.apache.cassandra.cql3.UntypedResultSet; -import org.apache.cassandra.cql3.UntypedResultSet.Row; -import org.apache.cassandra.db.ColumnFamily; -import org.apache.cassandra.db.RangeTombstone; -import org.apache.cassandra.db.RowMutation; -import org.apache.cassandra.db.SystemKeyspace; -import org.apache.cassandra.db.marshal.UTF8Type; -import org.apache.cassandra.utils.ByteBufferUtil; - -public class TriggerOptions -{ - private static final String CLASS_KEY = "class"; - private static final String OPTIONS_KEY = "trigger_options"; - - public static Map> getAllTriggers(String ksName, String cfName) - { - String req = "SELECT * FROM system.%s WHERE keyspace_name='%s' AND columnfamily_name='%s'"; - UntypedResultSet result = processInternal(String.format(req, SystemKeyspace.SCHEMA_TRIGGERS_CF, ksName, cfName)); - Map> triggers = new HashMap<>(); - if (result.isEmpty()) - return triggers; - for (Row row : result) - triggers.put(row.getString("trigger_name"), row.getMap(OPTIONS_KEY, UTF8Type.instance, UTF8Type.instance)); - return triggers; - } - - public static void addColumns(RowMutation rm, String cfName, Entry> tentry, long modificationTimestamp) - { - ColumnFamily cf = rm.addOrGet(CFMetaData.SchemaTriggersCf); - assert tentry.getValue().get(CLASS_KEY) != null; - ColumnNameBuilder builder = CFMetaData.SchemaTriggersCf.getCfDef().getColumnNameBuilder(); - builder.add(ByteBufferUtil.bytes(cfName)).add(ByteBufferUtil.bytes(tentry.getKey())).add(ByteBufferUtil.bytes(OPTIONS_KEY)); - for (Entry entry : tentry.getValue().entrySet()) - { - ColumnNameBuilder builderCopy = builder.copy(); - builderCopy.add(ByteBufferUtil.bytes(entry.getKey())); - cf.addColumn(builderCopy.build(), ByteBufferUtil.bytes(entry.getValue()), modificationTimestamp); - } - } - - public static void deleteColumns(RowMutation rm, String cfName, Entry> tentry, long modificationTimestamp) - { - ColumnFamily cf = rm.addOrGet(CFMetaData.SchemaTriggersCf); - int ldt = (int) (System.currentTimeMillis() / 1000); - ColumnNameBuilder builder = CFMetaData.SchemaTriggersCf.getCfDef().getColumnNameBuilder(); - builder.add(ByteBufferUtil.bytes(cfName)).add(ByteBufferUtil.bytes(tentry.getKey())); - cf.addAtom(new RangeTombstone(builder.build(), builder.buildAsEndOfRange(), modificationTimestamp, ldt)); - } - - public static void update(CFMetaData cfm, String triggerName, String clazz) - { - Map> existingTriggers = cfm.getTriggers(); - assert existingTriggers.get(triggerName) == null; - Map triggerUnit = new HashMap<>(); - triggerUnit.put(CLASS_KEY, clazz); - existingTriggers.put(triggerName, triggerUnit); - cfm.triggers(existingTriggers); - } - - public static void remove(CFMetaData cfm, String triggerName) - { - Map> existingTriggers = cfm.getTriggers(); // have a copy of the triggers - existingTriggers.remove(triggerName); - cfm.triggers(existingTriggers); - } - - public static boolean hasTrigger(CFMetaData cfm, String triggerName) - { - return cfm.getTriggers().get(triggerName) != null; - } - - public static Collection extractClasses(Map> triggers) - { - List classes = new ArrayList<>(); - if (triggers.isEmpty()) - return null; - for (Map options : triggers.values()) - classes.add(options.get(CLASS_KEY)); - return classes; - } -} diff --git a/src/java/org/apache/cassandra/cql3/statements/CreateTriggerStatement.java b/src/java/org/apache/cassandra/cql3/statements/CreateTriggerStatement.java index 172c05edc4..1e2ac900bf 100644 --- a/src/java/org/apache/cassandra/cql3/statements/CreateTriggerStatement.java +++ b/src/java/org/apache/cassandra/cql3/statements/CreateTriggerStatement.java @@ -17,13 +17,15 @@ */ package org.apache.cassandra.cql3.statements; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import org.apache.cassandra.auth.Permission; import org.apache.cassandra.config.CFMetaData; import org.apache.cassandra.config.Schema; -import org.apache.cassandra.config.TriggerOptions; +import org.apache.cassandra.config.TriggerDefinition; import org.apache.cassandra.cql3.CFName; import org.apache.cassandra.exceptions.ConfigurationException; -import org.apache.cassandra.exceptions.ExceptionCode; import org.apache.cassandra.exceptions.InvalidRequestException; import org.apache.cassandra.exceptions.RequestValidationException; import org.apache.cassandra.exceptions.UnauthorizedException; @@ -32,21 +34,19 @@ import org.apache.cassandra.service.MigrationManager; import org.apache.cassandra.thrift.ThriftValidation; import org.apache.cassandra.transport.messages.ResultMessage; import org.apache.cassandra.triggers.TriggerExecutor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class CreateTriggerStatement extends SchemaAlteringStatement { private static final Logger logger = LoggerFactory.getLogger(CreateTriggerStatement.class); private final String triggerName; - private final String clazz; + private final String triggerClass; public CreateTriggerStatement(CFName name, String triggerName, String clazz) { super(name); this.triggerName = triggerName; - this.clazz = clazz; + this.triggerClass = clazz; } public void checkAccess(ClientState state) throws UnauthorizedException, InvalidRequestException @@ -59,19 +59,19 @@ public class CreateTriggerStatement extends SchemaAlteringStatement ThriftValidation.validateColumnFamily(keyspace(), columnFamily()); try { - TriggerExecutor.instance.loadTriggerInstance(clazz); + TriggerExecutor.instance.loadTriggerInstance(triggerClass); } - catch (Exception ex) + catch (Exception e) { - throw new RequestValidationException(ExceptionCode.INVALID, "Trigger class: " + clazz + ", doesnt exist.", ex) {}; + throw new ConfigurationException(String.format("Trigger class '%s' doesn't exist", triggerClass)); } } public void announceMigration() throws InvalidRequestException, ConfigurationException { CFMetaData cfm = Schema.instance.getCFMetaData(keyspace(), columnFamily()).clone(); - TriggerOptions.update(cfm, triggerName, clazz); - logger.info("Adding triggers with name {} and classes {}", triggerName, clazz); + cfm.addTriggerDefinition(TriggerDefinition.create(triggerName, triggerClass)); + logger.info("Adding trigger with name {} and class {}", triggerName, triggerClass); MigrationManager.announceColumnFamilyUpdate(cfm, false); } diff --git a/src/java/org/apache/cassandra/cql3/statements/DropTriggerStatement.java b/src/java/org/apache/cassandra/cql3/statements/DropTriggerStatement.java index a60a249f0e..884aaa008a 100644 --- a/src/java/org/apache/cassandra/cql3/statements/DropTriggerStatement.java +++ b/src/java/org/apache/cassandra/cql3/statements/DropTriggerStatement.java @@ -17,13 +17,14 @@ */ package org.apache.cassandra.cql3.statements; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import org.apache.cassandra.auth.Permission; import org.apache.cassandra.config.CFMetaData; import org.apache.cassandra.config.Schema; -import org.apache.cassandra.config.TriggerOptions; import org.apache.cassandra.cql3.CFName; import org.apache.cassandra.exceptions.ConfigurationException; -import org.apache.cassandra.exceptions.ExceptionCode; import org.apache.cassandra.exceptions.InvalidRequestException; import org.apache.cassandra.exceptions.RequestValidationException; import org.apache.cassandra.exceptions.UnauthorizedException; @@ -31,12 +32,11 @@ import org.apache.cassandra.service.ClientState; import org.apache.cassandra.service.MigrationManager; import org.apache.cassandra.thrift.ThriftValidation; import org.apache.cassandra.transport.messages.ResultMessage; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class DropTriggerStatement extends SchemaAlteringStatement { private static final Logger logger = LoggerFactory.getLogger(DropTriggerStatement.class); + private final String triggerName; public DropTriggerStatement(CFName name, String triggerName) @@ -53,17 +53,13 @@ public class DropTriggerStatement extends SchemaAlteringStatement public void validate(ClientState state) throws RequestValidationException { ThriftValidation.validateColumnFamily(keyspace(), columnFamily()); - CFMetaData cfm = Schema.instance.getCFMetaData(keyspace(), columnFamily()); - if (cfm.getTriggerClasses() == null) - throw new RequestValidationException(ExceptionCode.CONFIG_ERROR, "No triggers found") {}; - if (!TriggerOptions.hasTrigger(cfm, triggerName)) - throw new RequestValidationException(ExceptionCode.CONFIG_ERROR, "trigger: " + triggerName + ", not found") {}; } public void announceMigration() throws InvalidRequestException, ConfigurationException { CFMetaData cfm = Schema.instance.getCFMetaData(keyspace(), columnFamily()).clone(); - TriggerOptions.remove(cfm, triggerName); + if (!cfm.removeTrigger(triggerName)) + throw new ConfigurationException(String.format("Trigger %s was not found", triggerName)); logger.info("Dropping trigger with name {}", triggerName); MigrationManager.announceColumnFamilyUpdate(cfm, false); } diff --git a/src/java/org/apache/cassandra/db/DefsTables.java b/src/java/org/apache/cassandra/db/DefsTables.java index 22a74c6dfa..06118d07bc 100644 --- a/src/java/org/apache/cassandra/db/DefsTables.java +++ b/src/java/org/apache/cassandra/db/DefsTables.java @@ -463,6 +463,7 @@ public class DefsTables SystemKeyspace.forceBlockingFlush(SystemKeyspace.SCHEMA_KEYSPACES_CF); SystemKeyspace.forceBlockingFlush(SystemKeyspace.SCHEMA_COLUMNFAMILIES_CF); SystemKeyspace.forceBlockingFlush(SystemKeyspace.SCHEMA_COLUMNS_CF); + SystemKeyspace.forceBlockingFlush(SystemKeyspace.SCHEMA_TRIGGERS_CF); } } diff --git a/src/java/org/apache/cassandra/db/SystemKeyspace.java b/src/java/org/apache/cassandra/db/SystemKeyspace.java index 2c232b1733..2e74ef6ada 100644 --- a/src/java/org/apache/cassandra/db/SystemKeyspace.java +++ b/src/java/org/apache/cassandra/db/SystemKeyspace.java @@ -676,11 +676,12 @@ public class SystemKeyspace public static List serializedSchema() { - List schema = new ArrayList(3); + List schema = new ArrayList<>(); schema.addAll(serializedSchema(SCHEMA_KEYSPACES_CF)); schema.addAll(serializedSchema(SCHEMA_COLUMNFAMILIES_CF)); schema.addAll(serializedSchema(SCHEMA_COLUMNS_CF)); + schema.addAll(serializedSchema(SCHEMA_TRIGGERS_CF)); return schema; } @@ -702,11 +703,12 @@ public class SystemKeyspace public static Collection serializeSchema() { - Map mutationMap = new HashMap(); + Map mutationMap = new HashMap<>(); serializeSchema(mutationMap, SCHEMA_KEYSPACES_CF); serializeSchema(mutationMap, SCHEMA_COLUMNFAMILIES_CF); serializeSchema(mutationMap, SCHEMA_COLUMNS_CF); + serializeSchema(mutationMap, SCHEMA_TRIGGERS_CF); return mutationMap.values(); } @@ -754,19 +756,25 @@ public class SystemKeyspace return new Row(key, result); } - public static Row readSchemaRow(String ksName, String cfName) + /** + * Fetches a subset of schema (table data, columns metadata or triggers) for the keyspace+table pair. + * + * @param schemaCfName the schema table to get the data from (schema_columnfamilies, schema_columns or schema_triggers) + * @param ksName the keyspace of the table we are interested in + * @param cfName the table we are interested in + * @return a Row containing the schema data of a particular type for the table + */ + public static Row readSchemaRow(String schemaCfName, String ksName, String cfName) { DecoratedKey key = StorageService.getPartitioner().decorateKey(getSchemaKSKey(ksName)); - - ColumnFamilyStore schemaCFS = SystemKeyspace.schemaCFS(SCHEMA_COLUMNFAMILIES_CF); - ColumnFamily result = schemaCFS.getColumnFamily(key, - DefsTables.searchComposite(cfName, true), - DefsTables.searchComposite(cfName, false), - false, - Integer.MAX_VALUE, - System.currentTimeMillis()); - - return new Row(key, result); + ColumnFamilyStore schemaCFS = SystemKeyspace.schemaCFS(schemaCfName); + ColumnFamily cf = schemaCFS.getColumnFamily(key, + DefsTables.searchComposite(cfName, true), + DefsTables.searchComposite(cfName, false), + false, + Integer.MAX_VALUE, + System.currentTimeMillis()); + return new Row(key, cf); } public static PaxosState loadPaxosState(ByteBuffer key, CFMetaData metadata) diff --git a/src/java/org/apache/cassandra/service/MigrationManager.java b/src/java/org/apache/cassandra/service/MigrationManager.java index b24c3c1e4c..8c31632db8 100644 --- a/src/java/org/apache/cassandra/service/MigrationManager.java +++ b/src/java/org/apache/cassandra/service/MigrationManager.java @@ -335,6 +335,7 @@ public class MigrationManager implements IEndpointStateChangeSubscriber SystemKeyspace.schemaCFS(SystemKeyspace.SCHEMA_KEYSPACES_CF).truncateBlocking(); SystemKeyspace.schemaCFS(SystemKeyspace.SCHEMA_COLUMNFAMILIES_CF).truncateBlocking(); SystemKeyspace.schemaCFS(SystemKeyspace.SCHEMA_COLUMNS_CF).truncateBlocking(); + SystemKeyspace.schemaCFS(SystemKeyspace.SCHEMA_TRIGGERS_CF).truncateBlocking(); if (logger.isDebugEnabled()) logger.debug("Clearing local schema keyspace definitions..."); diff --git a/src/java/org/apache/cassandra/triggers/TriggerExecutor.java b/src/java/org/apache/cassandra/triggers/TriggerExecutor.java index 6a7729564e..c3a2c44053 100644 --- a/src/java/org/apache/cassandra/triggers/TriggerExecutor.java +++ b/src/java/org/apache/cassandra/triggers/TriggerExecutor.java @@ -1,6 +1,4 @@ -package org.apache.cassandra.triggers; /* - * * 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 @@ -17,17 +15,19 @@ package org.apache.cassandra.triggers; * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * */ - +package org.apache.cassandra.triggers; import java.io.File; -import java.lang.reflect.Constructor; import java.nio.ByteBuffer; import java.util.Collection; import java.util.List; import java.util.Map; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; + +import org.apache.cassandra.config.TriggerDefinition; import org.apache.cassandra.cql.QueryProcessor; import org.apache.cassandra.db.ColumnFamily; import org.apache.cassandra.db.CounterMutation; @@ -36,9 +36,6 @@ import org.apache.cassandra.db.RowMutation; import org.apache.cassandra.exceptions.InvalidRequestException; import org.apache.cassandra.utils.FBUtilities; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; - public class TriggerExecutor { public static final TriggerExecutor instance = new TriggerExecutor(); @@ -106,20 +103,20 @@ public class TriggerExecutor */ private List execute(ByteBuffer key, ColumnFamily columnFamily) { - Collection triggerNames = columnFamily.metadata().getTriggerClasses(); - if (triggerNames == null) + Map triggers = columnFamily.metadata().getTriggers(); + if (triggers.isEmpty()) return null; List tmutations = Lists.newLinkedList(); Thread.currentThread().setContextClassLoader(customClassLoader); try { - for (String triggerName : triggerNames) + for (TriggerDefinition td : triggers.values()) { - ITrigger trigger = cachedTriggers.get(triggerName); + ITrigger trigger = cachedTriggers.get(td.classOption); if (trigger == null) { - trigger = loadTriggerInstance(triggerName); - cachedTriggers.put(triggerName, trigger); + trigger = loadTriggerInstance(td.classOption); + cachedTriggers.put(td.classOption, trigger); } Collection temp = trigger.augment(key, columnFamily); if (temp != null) @@ -142,8 +139,6 @@ public class TriggerExecutor // double check. if (cachedTriggers.get(triggerName) != null) return cachedTriggers.get(triggerName); - - Constructor costructor = (Constructor) customClassLoader.loadClass(triggerName).getConstructor(new Class[0]); - return costructor.newInstance(new Object[0]); + return (ITrigger) customClassLoader.loadClass(triggerName).getConstructor().newInstance(); } } diff --git a/test/unit/org/apache/cassandra/config/CFMetaDataTest.java b/test/unit/org/apache/cassandra/config/CFMetaDataTest.java index ce105c466d..b8c061fcb2 100644 --- a/test/unit/org/apache/cassandra/config/CFMetaDataTest.java +++ b/test/unit/org/apache/cassandra/config/CFMetaDataTest.java @@ -145,7 +145,7 @@ public class CFMetaDataTest extends SchemaLoader ColumnFamily serializedCf = rm.getColumnFamily(Schema.instance.getId(Keyspace.SYSTEM_KS, SystemKeyspace.SCHEMA_COLUMNFAMILIES_CF)); ColumnFamily serializedCD = rm.getColumnFamily(Schema.instance.getId(Keyspace.SYSTEM_KS, SystemKeyspace.SCHEMA_COLUMNS_CF)); UntypedResultSet.Row result = QueryProcessor.resultify("SELECT * FROM system.schema_columnfamilies", new Row(k, serializedCf)).one(); - CFMetaData newCfm = CFMetaData.addColumnDefinitionSchema(CFMetaData.fromSchemaNoColumns(result), new Row(k, serializedCD)); + CFMetaData newCfm = CFMetaData.addColumnDefinitionsFromSchema(CFMetaData.fromSchemaNoColumnsNoTriggers(result), new Row(k, serializedCD)); assert cfm.equals(newCfm) : String.format("\n%s\n!=\n%s", cfm, newCfm); } }