Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 864481092E for ; Wed, 3 Jul 2013 13:14:25 +0000 (UTC) Received: (qmail 42692 invoked by uid 500); 3 Jul 2013 13:14:23 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 42669 invoked by uid 500); 3 Jul 2013 13:14:23 -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 42661 invoked by uid 99); 3 Jul 2013 13:14:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Jul 2013 13:14:22 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of arodriguez@inconcertcc.com designates 200.40.135.92 as permitted sender) Received: from [200.40.135.92] (HELO zcs-mail.inconcertcc.com) (200.40.135.92) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Jul 2013 13:14:18 +0000 Received: from localhost (localhost [127.0.0.1]) by zcs-mail.inconcertcc.com (Postfix) with ESMTP id A7EEB254026 for ; Wed, 3 Jul 2013 10:13:36 -0300 (UYT) X-Virus-Scanned: amavisd-new at zcs-mail.inconcertcc.com Received: from zcs-mail.inconcertcc.com ([127.0.0.1]) by localhost (zcs-mail.inconcertcc.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JGTc+zchBXsR for ; Wed, 3 Jul 2013 10:13:35 -0300 (UYT) Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) by zcs-mail.inconcertcc.com (Postfix) with ESMTPSA id 03D8D254005 for ; Wed, 3 Jul 2013 10:13:34 -0300 (UYT) Received: by mail-wi0-f175.google.com with SMTP id m6so5212546wiv.8 for ; Wed, 03 Jul 2013 06:13:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=ipODJvrhQFOQkX6AbpdBGvk1jS2Nd2PythX2iLvrob4=; b=Zyn2aMal5BidkRZcdxsDEMOAOhUUhyDGsl5YKsv7xZA2TtUzB78ic3tVwEhAeOgMY1 Ni18Xec5YM4Xq4DhsHvumgvfOBfUYLtNYIoLo4vZ7+zpWQZQsl6O0y3IjC6/z+/mx70A 16AP9IhKSvi8fCqfLekw0OpKL09u6Xh5Ivpj4+cjRY4Q/rn6fQ3dGqUPKnHjAPAf/rni 2rXmaIqK7VIxkfg6Sh+uamCD/oE5aIcB2iAe/wJDnvKJmFE80eZdsMXbEg+Z9QBhsWNj SpoluxcbhvB6NEgoFj6cJ4dHTqq3bogdVm2MTQ+CvKya+wnTwRmBMKREG64x7sZa9M7I DnJQ== MIME-Version: 1.0 X-Received: by 10.194.77.99 with SMTP id r3mr628416wjw.5.1372857225186; Wed, 03 Jul 2013 06:13:45 -0700 (PDT) Received: by 10.194.9.137 with HTTP; Wed, 3 Jul 2013 06:13:45 -0700 (PDT) In-Reply-To: References: <165D0FD6-D9D4-4981-A5A6-A7FE02BB4BC2@gmail.com> Date: Wed, 3 Jul 2013 10:13:45 -0300 Message-ID: Subject: Re: Problem with libcassandra From: =?ISO-8859-1?Q?Alexis_Rodr=EDguez?= To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=047d7bfd09183c1ab604e09b3b27 X-Virus-Checked: Checked by ClamAV on apache.org --047d7bfd09183c1ab604e09b3b27 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Shubham, You are right, my point is that with non schema-update thrift calls you can tune the consistency level used. bye. On Wed, Jul 3, 2013 at 10:10 AM, Shubham Mittal wrot= e: > hi Alexis, > > Even if I create keyspaces, column families using cassandra-cli, the > column creation and insertion work will still need thrift calls. > > > On Wed, Jul 3, 2013 at 6:05 PM, Alexis Rodr=EDguez < > arodriguez@inconcertcc.com> wrote: > >> That repo for libcassandra works for cassandra 0.7.x due to changes in >> the thrift interface we have faced some problems in the past. >> >> May be you can take a look to my fork of libcassandra https://github.com= / >> axs-mvd/libcassandra that we are using with cassandra 1.1.11. >> >> Besides that, I recommend that you use the cassandra-cli to create >> keyspaces and column families because that operations fails if some of >> your nodes is down, so by using cassandra-cli you force, in a way, the >> supervision of a human being :D. >> >> good luck! >> >> >> On Wed, Jul 3, 2013 at 9:12 AM, Shubham Mittal wr= ote: >> >>> Hey, >>> >>> I found out that the problem is caused by this line : >>> c->createKeyspace(ks_def); >>> >>> because the below code works fine. >>> >>> #include >>> #include >>> #include >>> #include >>> #include >>> #include >>> #include >>> #include >>> >>> #include >>> #include >>> #include >>> #include >>> #include >>> >>> using namespace std; >>> using namespace libcassandra; >>> >>> static string host("127.0.0.1"); >>> static int port=3D 9160; >>> >>> int main() >>> { >>> >>> CassandraFactory cf(host, port); >>> tr1::shared_ptr c(cf.create()); >>> >>> KeyspaceDefinition ks_def; >>> ks_def.setName("demo"); >>> return 0; >>> } >>> >>> >>> On Wed, Jul 3, 2013 at 5:22 PM, Shubham Mittal w= rote: >>> >>>> no Jordan, the cassandra version I have is Cassandra 1.1.12 >>>> >>>> >>>> On Wed, Jul 3, 2013 at 5:21 PM, Shubham Mittal = wrote: >>>> >>>>> This is the gdb output >>>>> >>>>> [Thread debugging using libthread_db enabled] >>>>> terminate called after throwing an instance of >>>>> 'org::apache::cassandra::InvalidRequestException' >>>>> what(): Default TException. >>>>> >>>>> Program received signal SIGABRT, Aborted. >>>>> 0x00007ffff70a0b25 in raise () from /lib/libc.so.6 >>>>> >>>>> >>>>> >>>>> >>>>> On Wed, Jul 3, 2013 at 8:38 AM, Jeremiah D Jordan < >>>>> jeremiah.jordan@gmail.com> wrote: >>>>> >>>>>> If you are using 1.2, I would checkout >>>>>> https://github.com/mstump/libcql >>>>>> >>>>>> -Jeremiah >>>>>> >>>>>> On Jul 2, 2013, at 5:18 AM, Shubham Mittal >>>>>> wrote: >>>>>> >>>>>> I am trying to run below code, but it gives this error. It compiles >>>>>> without any errors. Kindly help me. >>>>>> (source of the code : >>>>>> http://posulliv.github.io/2011/02/27/libcassandra-sec-indexes/) >>>>>> >>>>>> terminate called after throwing an instance of >>>>>> 'org::apache::cassandra::InvalidRequestException' >>>>>> what(): Default TException. >>>>>> Aborted >>>>>> >>>>>> >>>>>> #include >>>>>> #include >>>>>> #include >>>>>> #include >>>>>> #include >>>>>> #include >>>>>> #include >>>>>> #include >>>>>> >>>>>> #include >>>>>> #include >>>>>> #include >>>>>> #include >>>>>> #include >>>>>> >>>>>> using namespace std; >>>>>> using namespace libcassandra; >>>>>> >>>>>> static string host("127.0.0.1"); >>>>>> static int port=3D 9160; >>>>>> >>>>>> int main() >>>>>> { >>>>>> >>>>>> CassandraFactory cf(host, port); >>>>>> tr1::shared_ptr c(cf.create()); >>>>>> >>>>>> KeyspaceDefinition ks_def; >>>>>> ks_def.setName("demo"); >>>>>> c->createKeyspace(ks_def); >>>>>> >>>>>> ColumnFamilyDefinition cf_def; >>>>>> cf_def.setName("users"); >>>>>> cf_def.setKeyspaceName(ks_def.getName()); >>>>>> >>>>>> ColumnDefinition name_col; >>>>>> name_col.setName("full_name"); >>>>>> name_col.setValidationClass("UTF8Type"); >>>>>> >>>>>> ColumnDefinition sec_col; >>>>>> sec_col.setName("birth_date"); >>>>>> sec_col.setValidationClass("LongType"); >>>>>> sec_col.setIndexType(org::apache::cassandra::IndexType::KEYS); >>>>>> >>>>>> ColumnDefinition third_col; >>>>>> third_col.setName("state"); >>>>>> third_col.setValidationClass("UTF8Type"); >>>>>> third_col.setIndexType(org::apache::cassandra::IndexType::KEYS); >>>>>> >>>>>> cf_def.addColumnMetadata(name_col); >>>>>> cf_def.addColumnMetadata(sec_col); >>>>>> cf_def.addColumnMetadata(third_col); >>>>>> >>>>>> c->setKeyspace(ks_def.getName()); >>>>>> c->createColumnFamily(cf_def); >>>>>> >>>>>> return 0; >>>>>> } >>>>>> >>>>>> >>>>>> >>>>> >>>> >>> >> > --047d7bfd09183c1ab604e09b3b27 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Shubham,=A0

You are right, my point is that with non schema-update thrift calls you can= tune the consistency level used.=A0

bye.


On Wed, Jul 3, 2013 at 10:10 AM, Shubham Mittal <smsmittal14@gmail.= com> wrote:
hi Alexis,

Even if I create keyspaces, column families using cassandra-cli, the col= umn creation and insertion work will still need thrift calls.

On Wed, Jul 3, 2013 at 6:05 PM, Alexis Rodr= =EDguez <arodriguez@inconcertcc.com> wrote:
That repo for libcassandra works for cassandra 0.7.x due to changes in the thrift i= nterface we have faced some problems in the past.

May be you can take a look to my fork of libcassandra=A0https://github.com/axs-= mvd/libcassandra that we are using with cas= sandra 1.1.11.=A0

Besides that, I recommend that you use the = cassandra-cli to create keyspaces an= d column families because that operations fails if some of your nodes is do= wn, so by using cassandra-cli you force, in a way= , the supervision of a human being :D.

good luck!


On Wed, Jul 3, 2013 at 9:12 AM, Shubham = Mittal <smsmittal14@gmail.com> wrote:
Hey,

I found out that the problem is ca= used by this line :
c->createKeyspace= (ks_def);

because the below code works fine.

#include <string.h>
#include <sstream>
#include <iostream>
#include <s= tdlib.h>
= #include <set>
#include <string>
#include <stdio.h>
#include <vector>

#include <libcassandra/cassandra_factory.h>
#include <libcass= andra/cassandra.h>
#include <libcassandra/column_family_definition.h>
#include <= libcassandra/keyspace.h>
#include <libcassandra/keyspace_definition.h>

using na= mespace std;
= using namespace libcassandra;

static string host("127.0.0.1");
static int port=3D 9160;

int main()
{

=A0 =A0 CassandraFactory cf(host, port);
=A0 =A0 tr1::shared= _ptr<Cassandra> c(cf.create());
=
=A0 =A0 KeyspaceDefinition ks_def;
=A0 =A0 ks_def.setName("demo");
=A0 =A0 return 0;
}


On Wed, Jul 3, 2013 at 5:22 PM, Shubham Mittal <smsmittal14@gmail.c= om> wrote:
no Jordan, the cassandra ve= rsion I have is=A0Cassandra 1.1.12=A0


On Wed, Jul 3, 2013 at 5:21 PM, Shubham = Mittal <smsmittal14@gmail.com> wrote:
This is the gdb output
=
[Thread debugging using libthre= ad_db enabled]
terminate called after throwing an instan= ce of 'org::apache::cassandra::InvalidRequestException'
=A0 what(): =A0Default TException.

Program received signal SIGABRT, Aborted.
0x00007ffff70a0b25 in raise () from /lib/libc.so.6




On Wed, Jul 3, 2013 at 8:38 AM, Jere= miah D Jordan <jeremiah.jordan@gmail.com> wrote:
If you a= re using 1.2, I would checkout=A0https://github.com/mstump/libcql

-Jeremiah

On= Jul 2, 2013, at 5:18 AM, Shubham Mittal <smsmittal14@gmail.com> wrote:

I am trying to run below cod= e, but it gives this error. It compiles without any errors. =A0Kindly help = me.
(source of the code :=A0http://posulliv.github.io= /2011/02/27/libcassandra-sec-indexes/)

terminate called after throwing = an instance of 'org::apache::cassandra::InvalidRequestException'
=A0 what(): =A0Default TException.
Aborted

=
#include <string.h>
#include <sstrea= m>
#include <iostream>
#include <stdlib.h&g= t;
#include <set>
#include <string>
#incl= ude <stdio.h>
#include <vector>

<= div>#include <libcassandra/cassandra_factory.h>
#include &l= t;libcassandra/cassandra.h>
#include <libcassandra/column_family_definition.h>
#in= clude <libcassandra/keyspace.h>
#include <libcassandra/k= eyspace_definition.h>

using namespace std;
using namespace libcassandra;

static string h= ost("127.0.0.1");
static int port=3D 9160;
int main()
{

=A0 =A0 Cassan= draFactory cf(host, port);
=A0 =A0 tr1::shared_ptr<Cassandra> c(cf.create());
=A0 =A0 KeyspaceDefinition ks_def;
=A0 =A0 ks_def.set= Name("demo");
=A0 =A0 c->createKeyspace(ks_def);
=A0 =A0=A0
=A0 =A0 ColumnFamilyDefinition cf_def;
=A0 =A0 cf_def.setNam= e("users");
=A0 =A0 cf_def.setKeyspaceName(ks_def.getNa= me());
=A0 =A0=A0
=A0 =A0 ColumnDefinition name_col;
=A0 =A0 name_col.setName("full_name");
=A0 =A0 name_col.setValidationClass("UTF8Type");
= =A0 =A0=A0
=A0 =A0 ColumnDefinition sec_col;
=A0 =A0 se= c_col.setName("birth_date");
=A0 =A0 sec_col.setValidat= ionClass("LongType");
=A0 =A0 sec_col.setIndexType(org::apache::cassandra::IndexType::KEYS);=
=A0 =A0=A0
=A0 =A0 ColumnDefinition third_col;
=A0 =A0 third_col.setName("state");
=A0 =A0 third_co= l.setValidationClass("UTF8Type");
=A0 =A0 third_col.setIndexType(org::apache::cassandra::IndexType::KEYS= );
=A0 =A0=A0
=A0 =A0 cf_def.addColumnMetadata(name_col= );
=A0 =A0 cf_def.addColumnMetadata(sec_col);
=A0 =A0 c= f_def.addColumnMetadata(third_col);
=A0 =A0=A0
=A0 =A0 c->setKeyspace(ks_def.getName());
=A0 =A0 c->createColumnFamily(cf_def);
=A0 =A0=A0
<= div>=A0 =A0 return 0;
}








--047d7bfd09183c1ab604e09b3b27--