CQL3 UUID as rowkey throwing BufferUnderflowException on Read. #240

Closed
repanag opened this Issue Mar 19, 2013 · 1 comment

Projects

None yet

3 participants

repanag commented Mar 19, 2013

Hi,

We have a test table created using CQL3 from cqlsh. row key is defined as uuid. While reading the rows, am getting the following error: Am using cassandra version 1.2.2. and astyanax version 1.56.31.

Caused by: com.netflix.astyanax.connectionpool.exceptions.UnknownException: UnknownException: [host=130.4.147.117(130.4.147.117):50825, latency=540(642), attempts=1]java.nio.BufferUnderflowException
at com.netflix.astyanax.thrift.ThriftConverter.ToConnectionPoolException(ThriftConverter.java:201)
at com.netflix.astyanax.thrift.AbstractOperationImpl.execute(AbstractOperationImpl.java:61)
at com.netflix.astyanax.thrift.AbstractOperationImpl.execute(AbstractOperationImpl.java:28)
at com.netflix.astyanax.thrift.ThriftSyncConnectionFactoryImpl$ThriftConnection.execute(ThriftSyncConnectionFactoryImpl.java:151)
at com.netflix.astyanax.connectionpool.impl.AbstractExecuteWithFailoverImpl.tryOperation(AbstractExecuteWithFailoverImpl.java:69)
at com.netflix.astyanax.connectionpool.impl.AbstractHostPartitionConnectionPool.executeWithFailover(AbstractHostPartitionConnectionPool.java:256)
at com.netflix.astyanax.thrift.AbstractThriftCqlQuery.execute(AbstractThriftCqlQuery.java:40)
at com.att.scld.grm.test.CassTest.searchRoutes2(CassTest.java:85)
... 1 more
Caused by: java.nio.BufferUnderflowException
at java.nio.Buffer.nextGetIndex(Buffer.java:478)
at java.nio.HeapByteBuffer.getLong(HeapByteBuffer.java:387)
at com.netflix.astyanax.serializers.UUIDSerializer.fromByteBuffer(UUIDSerializer.java:46)
at com.netflix.astyanax.serializers.UUIDSerializer.fromByteBuffer(UUIDSerializer.java:14)
at com.netflix.astyanax.serializers.AbstractSerializer.fromBytes(AbstractSerializer.java:44)
at com.netflix.astyanax.thrift.model.ThriftCqlRowsImpl.(ThriftCqlRowsImpl.java:42)
at com.netflix.astyanax.thrift.AbstractThriftCqlQuery$1.internalExecute(AbstractThriftCqlQuery.java:48)
at com.netflix.astyanax.thrift.AbstractThriftCqlQuery$1.internalExecute(AbstractThriftCqlQuery.java:42)
at com.netflix.astyanax.thrift.AbstractOperationImpl.execute(AbstractOperationImpl.java:56)
... 7 more

Code to retrieve:

        context = new AstyanaxContext.Builder()
                .forCluster(CLUSTER_NAME)
                .forKeyspace(keySpaceName)
                .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()      
                    .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)
                    .setCqlVersion("3.0.0")
                    .setTargetCassandraVersion("1.2.2")
                )  //TODO: set both connectionTimeout and readTimeout
                .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("MyConnectionPool")
                    .setPort(50825)
                    .setMaxConnsPerHost(10)
                    .setSeeds("nodename:50825")
                    .setConnectTimeout(20000)
                )
                .withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
                .buildKeyspace(ThriftFamilyFactory.getInstance());

        context.start();

        logger.log(Level.INFO, "getting context.. done ");
        keyspace = context.getEntity();

        ColumnFamily<UUID, String> routeCF = new ColumnFamily<UUID, String>("grd.test1",
                UUIDSerializer.get(), StringSerializer.get());

        OperationResult<CqlResult<UUID, String>> result = keyspace.prepareQuery(routeCF)
                .withCql("select * from grd.test1;")
                .execute();

        for (Row<UUID, String> row : result.getResult().getRows()) {
            System.out.println("Row Key: " + row.getKey());
            ColumnList<String> columns = row.getColumns();
            System.out.println("col1: " + columns.getUUIDValue("col1", null));
            System.out.println("col2: " + columns.getStringValue("col2", null));
            System.out.println("col3: " + columns.getStringValue("col3", null));
        }

table describe:
CREATE TABLE test1 (
col1 uuid PRIMARY KEY,
col2 text,
col3 text
) WITH
bloom_filter_fp_chance=0.010000 AND
caching='KEYS_ONLY' AND
comment='' AND
dclocal_read_repair_chance=0.000000 AND
gc_grace_seconds=864000 AND
read_repair_chance=0.100000 AND
replicate_on_write='true' AND
populate_io_cache_on_flush='false' AND
compaction={'class': 'SizeTieredCompactionStrategy'} AND
compression={'sstable_compression': 'SnappyCompressor'};

If i use the StringSerializer instead of the UUID, then it works but the rowkey is returned as null/empty:

        ColumnFamily<String, String> routeCF = new ColumnFamily<String, String>("grd.test1",
                StringSerializer.get(), StringSerializer.get());

        OperationResult<CqlResult<String, String>> result = keyspace.prepareQuery(routeCF)
                .withCql("select * from grd.test1;")
                .execute();

Am i missing something or is this a bug? Please let me know.

thanks,
srrepaka

@shyamalan shyamalan was assigned Apr 1, 2013
@elandau elandau closed this Apr 1, 2013
@elandau elandau reopened this Apr 1, 2013
Contributor

This is now fixed.

@shyamalan shyamalan closed this Apr 9, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment