Sean Billig created CASSANDRA-4202: -------------------------------------- Summary: CQL 3.0 prepare_cql_query fails on "BEGIN BATCH" Key: CASSANDRA-4202 URL: https://issues.apache.org/jira/browse/CASSANDRA-4202 Project: Cassandra Issue Type: Bug Components: API Affects Versions: 1.1.0 Environment: OSX 10.7.2, Cassandra 1.1.0, Thrift 0.7 Reporter: Sean Billig Priority: Minor
Preparing the following (contrived) statement with the C++ Thrift bindings throws a TTransportException ("No more data to read." from TTransport.h:41) q = "begin batch insert into crashtest (id, val) values (?, ?); apply batch"; client.prepare_cql_query(pr, q, Compression::NONE); {code:title=crashtest.cpp} #include <protocol/TBinaryProtocol.h> #include <thrift/transport/TSocket.h> #include <thrift/transport/TTransportUtils.h> #include "Cassandra.h" using namespace std; using namespace apache::thrift; using namespace apache::thrift::protocol; using namespace apache::thrift::transport; using namespace org::apache::cassandra; using namespace boost; int main(int argc, char **argv) { shared_ptr<TTransport> socket(new TSocket("127.0.0.1", 9160)); shared_ptr<TTransport> transport(new TFramedTransport(socket)); shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport)); CassandraClient client(protocol); try { transport->open(); client.set_keyspace("test1"); client.set_cql_version("3.0.0"); CqlResult cr; CqlPreparedResult pr; // In cqlsh: create table crashtest (id int primary key, val text); const char *q; // q = "insert into crashtest (id, val) values (?, ?)"; // This works fine q = "begin batch insert into crashtest (id, val) values (?, ?); apply batch"; client.prepare_cql_query(pr, q, Compression::NONE); vector<string> vtypes = pr.variable_types; vector<string>::iterator it; for (it = vtypes.begin(); it != vtypes.end(); it++) { cout << *it << endl; } } catch (TException &tx) { cerr << "TException ERROR: " << tx.what() << endl; } } {code} {code:title=backtrace} #0 0x00007fff901800e9 in __cxa_throw () #1 0x0000000100009ab9 in apache::thrift::transport::readAll<apache::thrift::transport::TBufferBase> (trans=@0x100401100, buf=0x7fff5fbfefc0 "??_\001", len=4) at TTransport.h:41 #2 0x0000000100009c1d in apache::thrift::transport::TBufferBase::readAll (this=0x100401100, buf=0x7fff5fbfefc0 "??_\001", len=4) at TBufferTransports.h:82 #3 0x0000000100009c5b in apache::thrift::transport::TFramedTransport::readAll (this=0x100401100, buf=0x7fff5fbfefc0 "??_\001", len=4) at TBufferTransports.h:390 #4 0x0000000100004b45 in apache::thrift::transport::TVirtualTransport<apache::thrift::transport::TFramedTransport, apache::thrift::transport::TBufferBase>::readAll_virt (this=0x100401100, buf=0x7fff5fbfefc0 "??_\001", len=4) at TVirtualTransport.h:99 #5 0x00000001000034c1 in apache::thrift::transport::TTransport::readAll (this=0x100401100, buf=0x7fff5fbfefc0 "??_\001", len=4) at TTransport.h:126 #6 0x0000000100009f4c in apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::readI32 (this=0x100401370, i32=@0x7fff5fbff020) at TBinaryProtocol.h:372 #7 0x000000010000b5bf in apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::readMessageBegin (this=0x100401370, name=@0x7fff5fbff228, messageType=@0x7fff5fbff224, seqid=@0x7fff5fbff234) at TBinaryProtocol.h:203 #8 0x0000000100006b07 in apache::thrift::protocol::TVirtualProtocol<apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>, apache::thrift::protocol::TProtocolDefaults>::readMessageBegin_virt (this=0x100401370, name=@0x7fff5fbff228, messageType=@0x7fff5fbff224, seqid=@0x7fff5fbff234) at TVirtualProtocol.h:432 #9 0x00000001000abe78 in apache::thrift::protocol::TProtocol::readMessageBegin (this=0x100401370, name=@0x7fff5fbff228, messageType=@0x7fff5fbff224, seqid=@0x7fff5fbff234) at TProtocol.h:518 #10 0x0000000100069a98 in org::apache::cassandra::CassandraClient::recv_prepare_cql_query (this=0x7fff5fbff5b0, _return=@0x7fff5fbff4c0) at Cassandra.cpp:10231 #11 0x000000010003bf3f in org::apache::cassandra::CassandraClient::prepare_cql_query (this=0x7fff5fbff5b0, _return=@0x7fff5fbff4c0, query=@0x7fff5fbff6b0, compression=org::apache::cassandra::Compression::NONE) at Cassandra.cpp:10206 #12 0x00000001000020ea in main (argc=1, argv=0x7fff5fbff8c8) at crashtest.cpp:36 {code} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira