You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Shubham Mittal <sm...@gmail.com> on 2013/07/02 12:18:02 UTC

Problem with libcassandra

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 <string.h>
#include <sstream>
#include <iostream>
#include <stdlib.h>
#include <set>
#include <string>
#include <stdio.h>
#include <vector>

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

using namespace std;
using namespace libcassandra;

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

int main()
{

    CassandraFactory cf(host, port);
    tr1::shared_ptr<Cassandra> 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;
}

Re: Problem with libcassandra

Posted by Alexis Rodríguez <ar...@inconcertcc.com>.
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 <sm...@gmail.com>wrote:

> 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íguez <
> 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 <sm...@gmail.com>wrote:
>>
>>> Hey,
>>>
>>> I found out that the problem is caused by this line :
>>> c->createKeyspace(ks_def);
>>>
>>> because the below code works fine.
>>>
>>> #include <string.h>
>>> #include <sstream>
>>> #include <iostream>
>>> #include <stdlib.h>
>>> #include <set>
>>> #include <string>
>>> #include <stdio.h>
>>> #include <vector>
>>>
>>> #include <libcassandra/cassandra_factory.h>
>>> #include <libcassandra/cassandra.h>
>>> #include <libcassandra/column_family_definition.h>
>>> #include <libcassandra/keyspace.h>
>>> #include <libcassandra/keyspace_definition.h>
>>>
>>> using namespace std;
>>> using namespace libcassandra;
>>>
>>> static string host("127.0.0.1");
>>> static int port= 9160;
>>>
>>> int main()
>>> {
>>>
>>>     CassandraFactory cf(host, port);
>>>     tr1::shared_ptr<Cassandra> c(cf.create());
>>>
>>>     KeyspaceDefinition ks_def;
>>>     ks_def.setName("demo");
>>>     return 0;
>>> }
>>>
>>>
>>> On Wed, Jul 3, 2013 at 5:22 PM, Shubham Mittal <sm...@gmail.com>wrote:
>>>
>>>> no Jordan, the cassandra version I have is Cassandra 1.1.12
>>>>
>>>>
>>>> On Wed, Jul 3, 2013 at 5:21 PM, Shubham Mittal <sm...@gmail.com>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 <sm...@gmail.com>
>>>>>> 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 <string.h>
>>>>>> #include <sstream>
>>>>>> #include <iostream>
>>>>>> #include <stdlib.h>
>>>>>> #include <set>
>>>>>> #include <string>
>>>>>> #include <stdio.h>
>>>>>> #include <vector>
>>>>>>
>>>>>> #include <libcassandra/cassandra_factory.h>
>>>>>> #include <libcassandra/cassandra.h>
>>>>>> #include <libcassandra/column_family_definition.h>
>>>>>> #include <libcassandra/keyspace.h>
>>>>>> #include <libcassandra/keyspace_definition.h>
>>>>>>
>>>>>> using namespace std;
>>>>>> using namespace libcassandra;
>>>>>>
>>>>>> static string host("127.0.0.1");
>>>>>> static int port= 9160;
>>>>>>
>>>>>> int main()
>>>>>> {
>>>>>>
>>>>>>     CassandraFactory cf(host, port);
>>>>>>     tr1::shared_ptr<Cassandra> 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;
>>>>>> }
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Re: Problem with libcassandra

Posted by Shubham Mittal <sm...@gmail.com>.
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íguez <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 <sm...@gmail.com>wrote:
>
>> Hey,
>>
>> I found out that the problem is caused by this line :
>> c->createKeyspace(ks_def);
>>
>> because the below code works fine.
>>
>> #include <string.h>
>> #include <sstream>
>> #include <iostream>
>> #include <stdlib.h>
>> #include <set>
>> #include <string>
>> #include <stdio.h>
>> #include <vector>
>>
>> #include <libcassandra/cassandra_factory.h>
>> #include <libcassandra/cassandra.h>
>> #include <libcassandra/column_family_definition.h>
>> #include <libcassandra/keyspace.h>
>> #include <libcassandra/keyspace_definition.h>
>>
>> using namespace std;
>> using namespace libcassandra;
>>
>> static string host("127.0.0.1");
>> static int port= 9160;
>>
>> int main()
>> {
>>
>>     CassandraFactory cf(host, port);
>>     tr1::shared_ptr<Cassandra> c(cf.create());
>>
>>     KeyspaceDefinition ks_def;
>>     ks_def.setName("demo");
>>     return 0;
>> }
>>
>>
>> On Wed, Jul 3, 2013 at 5:22 PM, Shubham Mittal <sm...@gmail.com>wrote:
>>
>>> no Jordan, the cassandra version I have is Cassandra 1.1.12
>>>
>>>
>>> On Wed, Jul 3, 2013 at 5:21 PM, Shubham Mittal <sm...@gmail.com>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 <sm...@gmail.com>
>>>>> 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 <string.h>
>>>>> #include <sstream>
>>>>> #include <iostream>
>>>>> #include <stdlib.h>
>>>>> #include <set>
>>>>> #include <string>
>>>>> #include <stdio.h>
>>>>> #include <vector>
>>>>>
>>>>> #include <libcassandra/cassandra_factory.h>
>>>>> #include <libcassandra/cassandra.h>
>>>>> #include <libcassandra/column_family_definition.h>
>>>>> #include <libcassandra/keyspace.h>
>>>>> #include <libcassandra/keyspace_definition.h>
>>>>>
>>>>> using namespace std;
>>>>> using namespace libcassandra;
>>>>>
>>>>> static string host("127.0.0.1");
>>>>> static int port= 9160;
>>>>>
>>>>> int main()
>>>>> {
>>>>>
>>>>>     CassandraFactory cf(host, port);
>>>>>     tr1::shared_ptr<Cassandra> 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;
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>

Re: Problem with libcassandra

Posted by Alexis Rodríguez <ar...@inconcertcc.com>.
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
keyspacesand 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 <sm...@gmail.com>wrote:

> Hey,
>
> I found out that the problem is caused by this line :
> c->createKeyspace(ks_def);
>
> because the below code works fine.
>
> #include <string.h>
> #include <sstream>
> #include <iostream>
> #include <stdlib.h>
> #include <set>
> #include <string>
> #include <stdio.h>
> #include <vector>
>
> #include <libcassandra/cassandra_factory.h>
> #include <libcassandra/cassandra.h>
> #include <libcassandra/column_family_definition.h>
> #include <libcassandra/keyspace.h>
> #include <libcassandra/keyspace_definition.h>
>
> using namespace std;
> using namespace libcassandra;
>
> static string host("127.0.0.1");
> static int port= 9160;
>
> int main()
> {
>
>     CassandraFactory cf(host, port);
>     tr1::shared_ptr<Cassandra> c(cf.create());
>
>     KeyspaceDefinition ks_def;
>     ks_def.setName("demo");
>     return 0;
> }
>
>
> On Wed, Jul 3, 2013 at 5:22 PM, Shubham Mittal <sm...@gmail.com>wrote:
>
>> no Jordan, the cassandra version I have is Cassandra 1.1.12
>>
>>
>> On Wed, Jul 3, 2013 at 5:21 PM, Shubham Mittal <sm...@gmail.com>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 <sm...@gmail.com>
>>>> 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 <string.h>
>>>> #include <sstream>
>>>> #include <iostream>
>>>> #include <stdlib.h>
>>>> #include <set>
>>>> #include <string>
>>>> #include <stdio.h>
>>>> #include <vector>
>>>>
>>>> #include <libcassandra/cassandra_factory.h>
>>>> #include <libcassandra/cassandra.h>
>>>> #include <libcassandra/column_family_definition.h>
>>>> #include <libcassandra/keyspace.h>
>>>> #include <libcassandra/keyspace_definition.h>
>>>>
>>>> using namespace std;
>>>> using namespace libcassandra;
>>>>
>>>> static string host("127.0.0.1");
>>>> static int port= 9160;
>>>>
>>>> int main()
>>>> {
>>>>
>>>>     CassandraFactory cf(host, port);
>>>>     tr1::shared_ptr<Cassandra> 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;
>>>> }
>>>>
>>>>
>>>>
>>>
>>
>

Re: Problem with libcassandra

Posted by Shubham Mittal <sm...@gmail.com>.
Hey,

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

because the below code works fine.

#include <string.h>
#include <sstream>
#include <iostream>
#include <stdlib.h>
#include <set>
#include <string>
#include <stdio.h>
#include <vector>

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

using namespace std;
using namespace libcassandra;

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

int main()
{

    CassandraFactory cf(host, port);
    tr1::shared_ptr<Cassandra> c(cf.create());

    KeyspaceDefinition ks_def;
    ks_def.setName("demo");
    return 0;
}


On Wed, Jul 3, 2013 at 5:22 PM, Shubham Mittal <sm...@gmail.com>wrote:

> no Jordan, the cassandra version I have is Cassandra 1.1.12
>
>
> On Wed, Jul 3, 2013 at 5:21 PM, Shubham Mittal <sm...@gmail.com>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 <sm...@gmail.com>
>>> 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 <string.h>
>>> #include <sstream>
>>> #include <iostream>
>>> #include <stdlib.h>
>>> #include <set>
>>> #include <string>
>>> #include <stdio.h>
>>> #include <vector>
>>>
>>> #include <libcassandra/cassandra_factory.h>
>>> #include <libcassandra/cassandra.h>
>>> #include <libcassandra/column_family_definition.h>
>>> #include <libcassandra/keyspace.h>
>>> #include <libcassandra/keyspace_definition.h>
>>>
>>> using namespace std;
>>> using namespace libcassandra;
>>>
>>> static string host("127.0.0.1");
>>> static int port= 9160;
>>>
>>> int main()
>>> {
>>>
>>>     CassandraFactory cf(host, port);
>>>     tr1::shared_ptr<Cassandra> 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;
>>> }
>>>
>>>
>>>
>>
>

Re: Problem with libcassandra

Posted by Shubham Mittal <sm...@gmail.com>.
no Jordan, the cassandra version I have is Cassandra 1.1.12


On Wed, Jul 3, 2013 at 5:21 PM, Shubham Mittal <sm...@gmail.com>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 <sm...@gmail.com> 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 <string.h>
>> #include <sstream>
>> #include <iostream>
>> #include <stdlib.h>
>> #include <set>
>> #include <string>
>> #include <stdio.h>
>> #include <vector>
>>
>> #include <libcassandra/cassandra_factory.h>
>> #include <libcassandra/cassandra.h>
>> #include <libcassandra/column_family_definition.h>
>> #include <libcassandra/keyspace.h>
>> #include <libcassandra/keyspace_definition.h>
>>
>> using namespace std;
>> using namespace libcassandra;
>>
>> static string host("127.0.0.1");
>> static int port= 9160;
>>
>> int main()
>> {
>>
>>     CassandraFactory cf(host, port);
>>     tr1::shared_ptr<Cassandra> 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;
>> }
>>
>>
>>
>

Re: Problem with libcassandra

Posted by Shubham Mittal <sm...@gmail.com>.
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 <sm...@gmail.com> 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 <string.h>
> #include <sstream>
> #include <iostream>
> #include <stdlib.h>
> #include <set>
> #include <string>
> #include <stdio.h>
> #include <vector>
>
> #include <libcassandra/cassandra_factory.h>
> #include <libcassandra/cassandra.h>
> #include <libcassandra/column_family_definition.h>
> #include <libcassandra/keyspace.h>
> #include <libcassandra/keyspace_definition.h>
>
> using namespace std;
> using namespace libcassandra;
>
> static string host("127.0.0.1");
> static int port= 9160;
>
> int main()
> {
>
>     CassandraFactory cf(host, port);
>     tr1::shared_ptr<Cassandra> 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;
> }
>
>
>

Re: Problem with libcassandra

Posted by Jeremiah D Jordan <je...@gmail.com>.
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 <sm...@gmail.com> 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 <string.h>
> #include <sstream>
> #include <iostream>
> #include <stdlib.h>
> #include <set>
> #include <string>
> #include <stdio.h>
> #include <vector>
> 
> #include <libcassandra/cassandra_factory.h>
> #include <libcassandra/cassandra.h>
> #include <libcassandra/column_family_definition.h>
> #include <libcassandra/keyspace.h>
> #include <libcassandra/keyspace_definition.h>
> 
> using namespace std;
> using namespace libcassandra;
> 
> static string host("127.0.0.1");
> static int port= 9160;
> 
> int main()
> {
> 
>     CassandraFactory cf(host, port);
>     tr1::shared_ptr<Cassandra> 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;
> }
> 


Re: Problem with libcassandra

Posted by Aaron Turner <sy...@gmail.com>.
Have you tried running your code in GDB to find which line is causing the
error?  That would be what I'd do first.

Aaron Turner
http://synfin.net/         Twitter: @synfinatic
https://github.com/synfinatic/tcpreplay - Pcap editing and replay tools for
Unix & Windows
Those who would give up essential Liberty, to purchase a little temporary
Safety, deserve neither Liberty nor Safety.
    -- Benjamin Franklin
"carpe diem quam minimum credula postero"


On Tue, Jul 2, 2013 at 3:18 AM, Shubham Mittal <sm...@gmail.com>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 <string.h>
> #include <sstream>
> #include <iostream>
> #include <stdlib.h>
> #include <set>
> #include <string>
> #include <stdio.h>
> #include <vector>
>
> #include <libcassandra/cassandra_factory.h>
> #include <libcassandra/cassandra.h>
> #include <libcassandra/column_family_definition.h>
> #include <libcassandra/keyspace.h>
> #include <libcassandra/keyspace_definition.h>
>
> using namespace std;
> using namespace libcassandra;
>
> static string host("127.0.0.1");
> static int port= 9160;
>
> int main()
> {
>
>     CassandraFactory cf(host, port);
>     tr1::shared_ptr<Cassandra> 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;
> }
>
>