Don't use destructive operations on the bytebuffer, always use e.g.
getLong(buffer.position)

On Fri, Jun 10, 2011 at 8:47 PM, Yang <teddyyyy...@gmail.com> wrote:
> 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.name
> buffer, which also preserves the pos.
>
> is this some error on server code? (looks a flip() is needed somewhere)
>
> Thanks
> Yang



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com

Reply via email to