thobbs / phpcassa

PHP client library for Apache Cassandra
thobbs.github.com/phpcassa
MIT License
248 stars 78 forks source link

Invalid bytes remaining after an end-of-component at component1 #66

Closed alonpeer closed 12 years ago

alonpeer commented 12 years ago

I'm using the Composite branch of phpcassa. I have a CF with composite column names:

ColumnFamily: MyCF
  Key Validation Class: org.apache.cassandra.db.marshal.UTF8Type
  Default column value validator: org.apache.cassandra.db.marshal.UTF8Type
  Columns sorted by: org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.AsciiType,org.apache.cassandra.db.marshal.IntegerType)
  Row cache size / save period in seconds / keys to save : 0.0/0/all
  Row Cache Provider: org.apache.cassandra.cache.SerializingCacheProvider
  Key cache size / save period in seconds: 200000.0/14400
  GC grace seconds: 864000
  Compaction min/max thresholds: 4/32
  Read repair chance: 0.1
  Replicate on write: true
  Bloom Filter FP chance: default
  Built indexes: []
  Compaction Strategy: org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy
  Compression Options:
    chunk_length_kb: 64
    sstable_compression: org.apache.cassandra.io.compress.SnappyCompressor

I occasionally get the following exception when trying to read data from it:

exception 'cassandra_InvalidRequestException' with message
'Invalid bytes remaining after an end-of-component at component1' in /phpcassa/thrift/packages/cassandra/Cassandra.php:256\nStack trace:
#0 /phpcassa/thrift/packages/cassandra/Cassandra.php(256): thrift_protocol_read_binary(Object(TBinaryProtocolAccelerated), 'cassandra_Cassa...', false)
#1 /phpcassa/thrift/packages/cassandra/Cassandra.php(229): CassandraClient->recv_get_slice()
#2 [internal function]: CassandraClient->get_slice('6034-28141406', Object(cassandra_ColumnParent), Object(cassandra_SlicePredicate), 2)
...

The command I'm running is:

$keys = array(
  serialize(array('total', 12345))
);
$cf->get('6034-28141406', $keys);
alonpeer commented 12 years ago

I've reported this to the Cassandra board as well, since this actually looks like an issue in core and not phpcassa.

https://issues.apache.org/jira/browse/CASSANDRA-4209

thobbs commented 12 years ago

I don't really have time to check this out on the composites branch at the moment, but it's worth noting that I'm almost certain this is working correctly in the reorg branch (soon to be the next release). Composites are pretty well tested (including almost this exact case) here: https://github.com/thobbs/phpcassa/blob/reorg/test/Autopacking/Standard/AutopackSerializedTest.php

I'll keep this open until I can test exactly this case later.

thobbs commented 12 years ago

I've verified that this is working correctly with the latest version of phpcassa. Let me know if you still have any problems.