TSocket read 0 bytes

3,867 views
Skip to first unread message

Stephen Jones

unread,
May 12, 2014, 1:16:52 PM5/12/14
to pycassa...@googlegroups.com
Hello there - 

I'm having trouble trying to understand this error. I'm sure this is just user error, but perhaps someone can shed a bit of light. I have a columnfamily and I need to add a new column entry that is a datetime type. For the columnfamily the default_validation_class is BytesType. When I try and add in this column and it's type - I get the following error. When I just try and insert the data and see if cassandra will auto_pack and figure out what type it should be, I get the same error. I'm sure I'm misunderstanding how this works, but any advice or input would be much appreciated. Thanks for your help. Cheers. 

my_sys = SystemManager(HOSTS[0])
my_sys.alter_column('keyspace', "mycolumnfamily", 'datetime', 'TimeUUIDType')

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/pycassa/system_manager.py", line 373, in alter_column
    self._system_update_column_family(self._alter_column_cfdef(cfdef, column, value_type))
  File "/usr/lib/python2.6/site-packages/pycassa/system_manager.py", line 277, in _system_update_column_family
    return self._schema_update(self._conn.system_update_column_family, cfdef)
  File "/usr/lib/python2.6/site-packages/pycassa/system_manager.py", line 456, in _schema_update
    schema_version = schema_func(*args)
  File "/usr/lib/python2.6/site-packages/pycassa/cassandra/Cassandra.py", line 1681, in system_update_column_family
    return self.recv_system_update_column_family()
  File "/usr/lib/python2.6/site-packages/pycassa/cassandra/Cassandra.py", line 1692, in recv_system_update_column_family
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
  File "/usr/lib64/python2.6/site-packages/thrift/protocol/TBinaryProtocol.py", line 126, in readMessageBegin
    sz = self.readI32()
  File "/usr/lib64/python2.6/site-packages/thrift/protocol/TBinaryProtocol.py", line 206, in readI32
    buff = self.trans.readAll(4)
  File "/usr/lib64/python2.6/site-packages/thrift/transport/TTransport.py", line 58, in readAll
    chunk = self.read(sz - have)
  File "/usr/lib64/python2.6/site-packages/thrift/transport/TTransport.py", line 271, in read
    self.readFrame()
  File "/usr/lib64/python2.6/site-packages/thrift/transport/TTransport.py", line 275, in readFrame
    buff = self.__trans.readAll(4)
  File "/usr/lib64/python2.6/site-packages/thrift/transport/TTransport.py", line 58, in readAll
    chunk = self.read(sz - have)
  File "/usr/lib64/python2.6/site-packages/thrift/transport/TSocket.py", line 118, in read
    message='TSocket read 0 bytes')
thrift.transport.TTransport.TTransportException: TSocket read 0 bytes

Tyler Hobbs

unread,
May 13, 2014, 11:52:11 AM5/13/14
to pycassa...@googlegroups.com
Usually this means there was some kind of problem server-side.  Can you check your Cassandra log to see if something shows up when you run this query?


--
You received this message because you are subscribed to the Google Groups "pycassa-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pycassa-discu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Tyler Hobbs
DataStax

Stephen Jones

unread,
May 20, 2014, 9:09:14 PM5/20/14
to pycassa...@googlegroups.com
Hey Tyler - 

Sorry for the delayed response, I've been working to change my plan of attach but still getting an issue when I try and create an indexed column. Here is what the log is saying when i run the following code. I'm honestly not too sure how far up to go in the log, but I've pasted the last ~50 lines. Thanks again for all your help! Cheers

sm = SystemManager('cassaws002')
sm.create_index('stats','CommandoFrameCF','show',UTF8_TYPE,index_name='cfframeshow')

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/pycassa/system_manager.py", line 416, in create_index
    self._system_update_column_family(cfdef)
  File "/usr/lib/python2.6/site-packages/pycassa/system_manager.py", line 277, in _system_update_column_family
    return self._schema_update(self._conn.system_update_column_family, cfdef)
  File "/usr/lib/python2.6/site-packages/pycassa/system_manager.py", line 456, in _schema_update
    schema_version = schema_func(*args)
  File "/usr/lib/python2.6/site-packages/pycassa/cassandra/Cassandra.py", line 1681, in system_update_column_family
    return self.recv_system_update_column_family()
  File "/usr/lib/python2.6/site-packages/pycassa/cassandra/Cassandra.py", line 1692, in recv_system_update_column_family
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
  File "/usr/lib64/python2.6/site-packages/thrift/protocol/TBinaryProtocol.py", line 126, in readMessageBegin
    sz = self.readI32()
  File "/usr/lib64/python2.6/site-packages/thrift/protocol/TBinaryProtocol.py", line 206, in readI32
    buff = self.trans.readAll(4)
  File "/usr/lib64/python2.6/site-packages/thrift/transport/TTransport.py", line 58, in readAll
    chunk = self.read(sz - have)
  File "/usr/lib64/python2.6/site-packages/thrift/transport/TTransport.py", line 271, in read
    self.readFrame()
  File "/usr/lib64/python2.6/site-packages/thrift/transport/TTransport.py", line 275, in readFrame
    buff = self.__trans.readAll(4)
  File "/usr/lib64/python2.6/site-packages/thrift/transport/TTransport.py", line 58, in readAll
    chunk = self.read(sz - have)
  File "/usr/lib64/python2.6/site-packages/thrift/transport/TSocket.py", line 118, in read
    message='TSocket read 0 bytes')
thrift.transport.TTransport.TTransportException: TSocket read 0 bytes


LOG:

ERROR [pool-8-thread-1] 2014-05-20 18:00:43,816 Message.java (line 319) Unexpected throwable while invoking!
java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: org.apache.cassandra.exceptions.ConfigurationException: Cannot modify validator to a non-order-compatible one for column 76657273696f6e since an index is set
        at org.apache.cassandra.utils.FBUtilities.waitOnFuture(FBUtilities.java:413)
        at org.apache.cassandra.service.MigrationManager.announce(MigrationManager.java:275)
        at org.apache.cassandra.service.MigrationManager.announceColumnFamilyUpdate(MigrationManager.java:239)
        at org.apache.cassandra.thrift.CassandraServer.system_update_column_family(CassandraServer.java:1662)
        at org.apache.cassandra.thrift.Cassandra$Processor$system_update_column_family.getResult(Cassandra.java:4430)
        at org.apache.cassandra.thrift.Cassandra$Processor$system_update_column_family.getResult(Cassandra.java:4414)
        at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
        at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
        at com.thinkaurelius.thrift.Message.invoke(Message.java:309)
        at com.thinkaurelius.thrift.Message$Invocation.execute(Message.java:90)
        at com.thinkaurelius.thrift.TDisruptorServer$InvocationHandler.onEvent(TDisruptorServer.java:625)
        at com.thinkaurelius.thrift.TDisruptorServer$InvocationHandler.onEvent(TDisruptorServer.java:619)
        at com.lmax.disruptor.WorkProcessor.run(WorkProcessor.java:112)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:724)
Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: org.apache.cassandra.exceptions.ConfigurationException: Cannot modify validator to a non-order-compatible one for column 76657273696f6e since an index is set
        at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
        at java.util.concurrent.FutureTask.get(FutureTask.java:111)
        at org.apache.cassandra.utils.FBUtilities.waitOnFuture(FBUtilities.java:409)
        ... 15 more
Caused by: java.lang.RuntimeException: org.apache.cassandra.exceptions.ConfigurationException: Cannot modify validator to a non-order-compatible one for column 76657273696f6e since an index is set
        at org.apache.cassandra.config.CFMetaData.reload(CFMetaData.java:997)
        at org.apache.cassandra.db.DefsTables.updateColumnFamily(DefsTables.java:377)
        at org.apache.cassandra.db.DefsTables.mergeColumnFamilies(DefsTables.java:318)
        at org.apache.cassandra.db.DefsTables.mergeSchema(DefsTables.java:183)
        at org.apache.cassandra.service.MigrationManager$2.runMayThrow(MigrationManager.java:293)
        at org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:28)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        ... 3 more
Caused by: org.apache.cassandra.exceptions.ConfigurationException: Cannot modify validator to a non-order-compatible one for column 76657273696f6e since an index is set
        at org.apache.cassandra.config.ColumnDefinition.apply(ColumnDefinition.java:279)
        at org.apache.cassandra.config.CFMetaData.apply(CFMetaData.java:1054)
        at org.apache.cassandra.config.CFMetaData.reload(CFMetaData.java:993)
        ... 11 more

Stephen Jones

unread,
May 20, 2014, 9:22:21 PM5/20/14
to pycassa...@googlegroups.com
I've also tried creating and indexed column using cqlsh with not much luck either. Here's what I've run to try and create an index in cqlsh... any ideas? Thanks 

cqlsh> use stats;
cqlsh:stats> CREATE INDEX show_key ON CommandoFrameCF (show_idx) ;
Bad Request: unconfigured columnfamily commandoframecf

Tyler Hobbs

unread,
May 22, 2014, 12:34:03 PM5/22/14
to pycassa...@googlegroups.com
I would avoid using cqlsh to make schema changes to column families that you use through thrift/pycassa; sometimes this ends up changing the metadata in a subtle way that can cause problems.

Regarding the error that you get when trying to create the index through pycassa, it looks like there's either already an index on that column or it already has a validator that's a different type.  Can you confirm that if there's a validator on that column, it's UTF8Type?


--
You received this message because you are subscribed to the Google Groups "pycassa-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pycassa-discu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Tyler Hobbs
DataStax
Reply all
Reply to author
Forward
0 new messages