Astyanax composite column put using AnnotatedCompositeSerializer becomes un-gettable after a few hours via multiple clients
Asked Answered
E

1

6

I'm having a bizarre issue. My java application puts columns into cassandra via astyanax. This seems to work temporarily, but after several hours the column seemingly disappears if I get by [row][composite column]. If I fetch the whole row, or get a range of columns that ought to include the column, then the column is returned. This behavior occurs in multiple clients, including the cassandra-cli and pycassa. For example:

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 so:

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

This has been baffling me for some time. Initially I thought the issue might be the column family. I've tried creating new column families and it hasn't helped. My suspicion is that there's something messed up with the composite column serialization, but that's just my intuition. Any ideas what's going on and how I can fix the issue? Thanks!

Embroil answered 12/8, 2014 at 13:2 Comment(0)
P
-1

Just a hunch - Can you try changing the IntegerType to Int32Type in the Composite Key and check if you have the same problem?

Psia answered 21/8, 2014 at 15:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.