You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Arya Goudarzi <ag...@gaiaonline.com> on 2010/05/21 05:16:19 UTC

New Changes in Cass 0.7 Thrift API Interface

Hi Fellows, 

I just joined this mailing list but I've been on the IRC for a while. Pardon if this post is a repeat but I would like to share with you some of my experiences with Cassandra Thrift Interface that comes with the nightly built and probably 0.7. I came across an issue last night that I shared on the IRC, and I've found the solutions to that too, so read on as this might be your problem too in the future. 

I've noticed fundamental differences in the new Thrift Interface from the bleeding edge version. First of all, if you've coded with the Thrift interface that is shipped with 0.6 branches, your code will not work with the new interface shipped with 0.7. This is because if you look at function declarations inside CassandraClient Interface, you'll see changes for example in insert() number of parameter and the way objects are passed. This also makes the examples on the Wiki site obsolete. If you are using TBinaryProtocolAccelerated in your application, then you won't be able to figure what is the problem at first glance because it crashes web server process with a message like this: 

[Wed May 19 16:15:12 2010] [notice] child pid 32414 exit signal Aborted (6) 
terminate called after throwing an instance of 'PHPExceptionWrapper' 
what(): PHP exception zval=0x2b1c2a0429a0 

This is a Thrift bug with thrift_protocol.so extention. Luckily I found the patch here: 

https://issues.apache.org/jira/browse/THRIFT-780 

After applying the patch and recompiling the module, Exceptions bubbled up to my app. I got complaines about T_STRUCT being different: 

TProtocolException Object ( [message:protected] => Attempt to send non-object type as a T_STRUCT [string:Exception:private] => [code:protected] ....... 

Well because the way I used to pass stuff to insert() was different from the way it should be in the new API. I discovered this the hard way and now am sharing the sauce with you. The example on the Wiki, will become something like this: 

$column = new cassandra_Column(array('name' => 'email', 
'value' => 'example@foo.com', 
'timestamp' => time())); 

$parent = new cassandra_ColumnParent(array('column_family' => 'Standard1')); 

// We want the consistency level to be ZERO which means async operations on 1 node 
$consistency_level = cassandra_ConsistencyLevel::ZERO; 

// Add the value to be written to the table, User Key, and path. 
$client->set_keyspace('Standard1'); 
$client->insert('1', $parent, $column, $consistency_level); 

Notice no more KeySpaces and ColumnPath passed to the insert(). Other functions are changed too. 

Good Luck, 

-Arya 

P.S. By the way, if someone grants me access, I'd like to contribute to the documentaions on Apache Cassandra. 

Re: New Changes in Cass 0.7 Thrift API Interface

Posted by Gary Dusbabek <gd...@gmail.com>.
On Thu, May 20, 2010 at 22:16, Arya Goudarzi <ag...@gaiaonline.com> wrote:
>
> P.S. By the way, if someone grants me access, I'd like to contribute to the
> documentaions on Apache Cassandra.
>

I believe anybody can create a wiki account and make changes.  Have at it!

Gary.