簡體   English   中英

使用AnnotatedCompositeSerializer放置的Astyanax復合柱在幾個小時后通過多個客戶端變得無法獲取

[英]Astyanax composite column put using AnnotatedCompositeSerializer becomes un-gettable after a few hours via multiple clients

我有一個奇怪的問題。 我的java應用程序通過astyanax將列放入cassandra。 這似乎是暫時的,但是幾個小時之后, 如果我通過[row] [復合列], 那么該列似乎就會消失。 如果我獲取整行,或者獲取應該包含該列的一系列列,則返回該列。 此行為發生在多個客戶端,包括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;
        }
    }
}

我的應用程序寫入列族,如下所示:

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

這讓我困惑了一段時間。 最初我認為問題可能是列族。 我嘗試過創建新的列族,但沒有幫助。 我懷疑復合列序列化有些混亂,但這只是我的直覺。 任何想法發生了什么以及我如何解決這個問題? 謝謝!

只是預感 - 您可以嘗試在復合鍵中將IntegerType更改為Int32Type並檢查是否有相同的問題?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM