Return-Path: Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: (qmail 31283 invoked from network); 21 May 2010 03:16:50 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 21 May 2010 03:16:50 -0000 Received: (qmail 86360 invoked by uid 500); 21 May 2010 03:16:49 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 85998 invoked by uid 500); 21 May 2010 03:16:48 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 85981 invoked by uid 99); 21 May 2010 03:16:48 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 May 2010 03:16:48 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of agoudarzi@gaiaonline.com designates 208.85.94.60 as permitted sender) Received: from [208.85.94.60] (HELO zms-vm01.sv3.gaiaonline.com) (208.85.94.60) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 May 2010 03:16:41 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by zms-vm01.sv3.gaiaonline.com (Postfix) with ESMTP id 7D354CD4002C for ; Thu, 20 May 2010 20:16:19 -0700 (PDT) X-Virus-Scanned: amavisd-new at zms-vm01.sv3.gaiaonline.com Received: from zms-vm01.sv3.gaiaonline.com ([127.0.0.1]) by localhost (zms-vm01.sv3.gaiaonline.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vp5FcCn0va24; Thu, 20 May 2010 20:16:19 -0700 (PDT) Received: from zms-vm01.sv3.gaiaonline.com (zms-vm01.sv3.gaiaonline.com [208.85.94.60]) by zms-vm01.sv3.gaiaonline.com (Postfix) with ESMTP id 13DD5CD4002B; Thu, 20 May 2010 20:16:19 -0700 (PDT) Date: Thu, 20 May 2010 20:16:19 -0700 (PDT) From: Arya Goudarzi To: user@cassandra.apache.org Message-ID: <7053140.141274411776869.JavaMail.arya@aryanet> In-Reply-To: <8519158.121274411583499.JavaMail.arya@aryanet> Subject: New Changes in Cass 0.7 Thrift API Interface MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_7_2711462.1274411776867" X-Originating-IP: [192.168.5.2] X-Mailer: Zimbra 6.0.6_GA_2324.RHEL5_64 (Zimbra Desktop/1.0.4_1833_Mac) X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_7_2711462.1274411776867 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit 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. ------=_Part_7_2711462.1274411776867 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable <= div style=3D'font-family: Times New Roman; font-size: 12pt; color: #000000'= >Hi Fellows,

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

I've notic= ed fundamental differences in the new Thrift Interface from the bleeding ed= ge 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 insi= de CassandraClient Interface, you'll see changes for example in insert() nu= mber of parameter and the way objects are passed. This also makes the examp= les 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 a= t first glance because it crashes web server process with a message like th= is:

[Wed May 19 16:15:12 2010] [notice] child pid 32414 exit signal = Aborted (6)
terminate called after throwing an instance of 'PHPException= Wrapper'
  what():  PHP exception zval=3D0x2b1c2a0429a0
This is a Thrift bug with thrift_protocol.so extention. Luckily I found th= e patch here:

https://issues.apache.org/jira/browse/THRIFT-780
After applying the patch and recompiling the module, Exceptions bubbled u= p to my app. I got complaines about T_STRUCT being different:

TProto= colException Object ( [message:protected] =3D> Attempt to send non-objec= t type as a T_STRUCT [string:Exception:private] =3D> [code:protected] ..= .....

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

$column =3D new cassandra_Colu= mn(array('name' =3D> 'email',
        &= nbsp;               =                 = ; 'value' =3D> 'example@foo.com',
       &nb= sp;               &n= bsp;               &= nbsp;  'timestamp' =3D> time()));

  $parent =3D new cas= sandra_ColumnParent(array('column_family' =3D> 'Standard1'));

&nb= sp; // We want the consistency level to be ZERO which means async operation= s on 1 node
  $consistency_level =3D cassandra_ConsistencyLevel::ZE= RO;

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

Notice no mor= e KeySpaces and ColumnPath passed to the insert(). Other functions are chan= ged too.

Good Luck,

-Arya

P.S. By the way, if someone = grants me access, I'd like to contribute to the documentaions on Apache Cas= sandra.
------=_Part_7_2711462.1274411776867--