Astyanax composite column placed with AnnotatedCompositeSerializer becomes unforgettable after a few hours after several clients

I have a strange problem. A java application puts columns in cassandra via astyanax. This seems to work temporarily, but after a few hours the column seems to disappear if I get [row] [composite column]. If I get the whole row or get a series of columns that should include a column, the column is returned. This behavior is seen in several clients, including cassandra-cli and pycassa. For instance:

get msg_metadata['someKey']; => (column=185779:completed, value={"timestamp":"1407777081","id":"167727"}, timestamp=1407777083241001) Returned 1 results. Elapsed time: 58 msec(s) get msg_metadata['someKey']['185779:completed']; => (column=185779:completed, value={"timestamp":"1407777081","id":"167727"}, timestamp=1407777083241001) Returned 1 results. Elapsed time: 42 msec(s) -- several hours later get msg_metadata['someKey']['185779:completed']; Value was not found Elapsed time: 72 msec(s). get msg_metadata['someKey']; => (column=185779:completed, value={"timestamp":"1407777081","id":"167727"}, timestamp=1407777083241001) Returned 1 results. Elapsed time: 107 msec(s) 

I created the following column family in a Cassandra 1.1.12 cluster:

 create column family msg_metadata with column_type = 'Standard' and comparator = 'CompositeType(org.apache.cassandra.db.marshal.IntegerType,org.apache.cassandra.db.marshal.AsciiType)' and default_validation_class = 'UTF8Type' and key_validation_class = 'AsciiType'; 

I have the following code using Astyanax 1.0.3

 public class ColumnFamilies { public static final AnnotatedCompositeSerializer<MyField> MY_FIELD = new AnnotatedCompositeSerializer<MyField>(MyField.class); public static final ColumnFamily<String, MyField> MESSAGE_METADATA = new ColumnFamily<String, MyField>( "msg_metadata", AsciiSerializer.get(), MY_FIELD); public static class MyField { @Component(ordinal = 0) private Integer myId; @Component(ordinal = 1) private String fieldName; public CustomerField(Integer myId, String fieldName) { this.myId = myId; this.fieldName = fieldName; } } } 

My application writes to the column family like this:

  final MutationBatch mutationBatch = MESSAGE_METADATA.prepareMutationBatch(); final MyField field = new MyField(myId, fieldName); mutationBatch.withRow(rowKey).putColumn(field, value, null); mutationBatch.execute(); 

This puzzled me for a while. Initially, I thought the problem could be a column family. I tried creating new column families and that didn't help. My suspicion is that there is something messed up with complicated serialization of columns, but this is just my intuition. Any ideas what is going on and how can I solve the problem? Thanks!

+6
source share
1 answer

Just a hunch. Can you try changing IntegerType to Int32Type in a composite key and check if you have the same problem?

-1
source

Source: https://habr.com/ru/post/973709/


All Articles