Java 使用AnnotatedCompositeSerializer的Astyanax复合列put在几个小时后通过多个客户端变得不可获取

Java 使用AnnotatedCompositeSerializer的Astyanax复合列put在几个小时后通过多个客户端变得不可获取,java,cassandra,astyanax,Java,Cassandra,Astyanax,我有一个奇怪的问题。我的java应用程序通过astyanax将列放入cassandra。这似乎暂时有效,但几个小时后,如果我通过[行][复合列],该列似乎消失了。如果我获取整行,或者获取应该包含该列的列的范围,则返回该列。这种行为发生在多个客户端中,包括cassandra cli和pycassa。例如: get msg_metadata['someKey']; => (column=185779:completed, value={"timestamp":"1407777081","id"

我有一个奇怪的问题。我的java应用程序通过astyanax将列放入cassandra。这似乎暂时有效,但几个小时后,如果我通过[行][复合列],该列似乎消失了。如果我获取整行,或者获取应该包含该列的列的范围,则返回该列。这种行为发生在多个客户端中,包括cassandra cli和pycassa。例如:

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)
我在Cassandra 1.1.12集群中创建了以下列族:

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';
我有以下代码,使用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;
        }
    }
}

这让我困惑了一段时间。起初,我认为问题可能在于column家族。我尝试过创建新的专栏族,但没有效果。我怀疑复合列序列化有问题,但这只是我的直觉。你知道发生了什么事以及我如何解决这个问题吗?谢谢

只是一种预感-您可以尝试将复合键中的IntegerType更改为Int32Type,并检查是否存在相同的问题吗

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