incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yang <teddyyyy...@gmail.com>
Subject simple get_slice() gives error?
Date Sat, 11 Jun 2011 01:47:13 GMT
I'm using thrift.CassandraServer directly within the same cassandra JVM to
accomplish my application tasks.
(I understand that this is not the normal usage mode...., but the error here
may also be appearing in Cassandra server code
development, so I thought it could be of some value to look at )
I ran into some issues when I try to parse out values from column name
ByteBuffer:


something like the following

List<ColumnOrSuperColumn> cols = cassandra_svr.get_slice(key, path,
predicate, ConsistencyLevel.ONE);
for(ColumnOrSuperColumn colOrSup: cols) {
Column col = colOrSup.column;
long ts = col.name.getLong();  <======


sometimes the last sentence gives error "ByteBuffer underflow", I checked
that the buffer size is 8 bytes, and the "pos" points to 8 already.  it
seems that somewhere in
thrift.CassandraServer line 179---195

    public List<ColumnOrSuperColumn> thriftifyColumns(Collection<IColumn>
columns, boolean reverseOrder)
    {
...........................................................
            {
                Column thrift_column = new Column(column.name
()).setValue(column.value()).setTimestamp(column.timestamp());

the ctor of Column(Column ) is used, which just uses the old
column.namebuffer, which also preserves the pos.


is this some error on server code? (looks a flip() is needed somewhere)


Thanks
Yang

Mime
View raw message