You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Thamizh <tc...@yahoo.co.in> on 2011/09/07 15:13:29 UTC

Secondary index update issue

Hi All,
I have created KS & CF using cassandra-0.7.8 and inserted some 
rows and column values(around 1000 rows). Later, I wanted to index 2 
column values. So, I issued 'update column family..' command. After, 
when I query based on indexed value it says "Row does not found".
After indexing 1. Issued nodetool flush 2.restarted Cassandra once. 
Though it is same. But, I could see some XXX-Index.db file on cassandra 
data directory.
What am I missing?

Here are CF details,

create column family ipinfo with column_type=Standard and 
default_validation_class =   UTF8Type and comparator=UTF8Type and
keys_cached=25000 and rows_cached=5000 and column_metadata=[
{ column_name : country, validation_class : UTF8Type},
{ column_name : ip, validation_class : LongType},
{ column_name : domain, validation_class : UTF8Type },
];

update column family ip with column_type=Standard and 
default_validation_class = UTF8Type and comparator=UTF8Type and
keys_cached=25000 and rows_cached=5000 and column_metadata=[
{column_name : country, validation_class : UTF8Type },
{column_name : domain, validation_class : UTF8Type, index_type: KEYS},
{column_name : ip, validation_class : LongType, index_type: KEYS}
];


Any suggestions would be appreciated

Regards,

  Thamizhannal P

Re: Secondary index update issue

Posted by Jonathan Ellis <jb...@gmail.com>.
If the queries are working successfully, I'm afraid I don't understand
the problem.

On Wed, Sep 7, 2011 at 12:48 PM, Thamizh <tc...@yahoo.co.in> wrote:
>
> Hi,
>
> Here is my sample row. I wanted to execute below 2 queries. CF:ip
> 1. get ip where ip=19268678;
> 2. get ip where domain='google.com';
>
> Here both ip & domain has secondary indexes.
>
> RowKey: 19268678
> => (column=country, value=in, timestamp=1315398995980)
> => (column=domain, value=google.com, timestamp=1315398995980)
> => (column=ip, value=19268678, timestamp=1315398995980)
>
> What encoding format should I use?. Here I defined ip as LongType & domain as utf8.
>
> When I upload data using above mentioned index type on CF definition then, above queries are working sucessfully. Why?
>
>
> Regards,
> Thamizhannal P
>
> --- On Wed, 7/9/11, Jonathan Ellis <jb...@gmail.com> wrote:
>
> From: Jonathan Ellis <jb...@gmail.com>
> Subject: Re: Secondary index update issue
> To: user@cassandra.apache.org
> Date: Wednesday, 7 September, 2011, 7:29 PM
>
> My guess would be you're querying using a different encoding and there
> really is no data for your query as given.  Hard to say without more
> details.
>
> On Wed, Sep 7, 2011 at 8:13 AM, Thamizh <tc...@yahoo.co.in> wrote:
> >
> > Hi All,
> >
> > I have created KS & CF using cassandra-0.7.8 and inserted some rows and column values(around 1000 rows). Later, I wanted to index 2 column values. So, I issued 'update column family..' command. After, when I query based on indexed value it says "Row does not found". After indexing 1. Issued nodetool flush 2.restarted Cassandra once. Though it is same. But, I could see some XXX-Index.db file on cassandra data directory. What am I missing?
> >
> > Here are CF details,
> >
> > create column family ipinfo with column_type=Standard and
> > default_validation_class =   UTF8Type and comparator=UTF8Type and
> > keys_cached=25000 and rows_cached=5000 and column_metadata=[
> > { column_name : country, validation_class : UTF8Type},
> > { column_name : ip, validation_class : LongType},
> > { column_name : domain, validation_class : UTF8Type },
> > ];
> >
> > update column family ip with column_type=Standard and
> > default_validation_class = UTF8Type and comparator=UTF8Type and
> > keys_cached=25000 and rows_cached=5000 and column_metadata=[
> > {column_name : country, validation_class : UTF8Type },
> > {column_name : domain, validation_class : UTF8Type, index_type: KEYS},
> > {column_name : ip, validation_class : LongType, index_type: KEYS}
> > ];
> >
> > Any suggestions would be appreciated
> >
> > Regards,
> > Thamizhannal P
>
>
> --
> Jonathan Ellis
> Project Chair, Apache Cassandra
> co-founder of DataStax, the source for professional Cassandra support
> http://www.datastax.com



--
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com

Re: Secondary index update issue

Posted by Thamizh <tc...@yahoo.co.in>.
Hi,

Here is my sample row. I wanted to execute below 2 queries. CF:ip
1. get ip where ip=19268678;
2. get ip where domain='google.com';

Here both ip & domain has secondary indexes.

RowKey: 19268678
=> (column=country, value=in, timestamp=1315398995980)
=> (column=domain, value=google.com, timestamp=1315398995980)
=> (column=ip, value=19268678, timestamp=1315398995980)

What encoding format should I use?. Here I defined ip as LongType & domain as utf8.

When I upload data using above mentioned index type on CF definition then, above queries are working sucessfully. Why?


Regards,

  Thamizhannal P

--- On Wed, 7/9/11, Jonathan Ellis <jb...@gmail.com> wrote:

From: Jonathan Ellis <jb...@gmail.com>
Subject: Re: Secondary index update issue
To: user@cassandra.apache.org
Date: Wednesday, 7 September, 2011, 7:29 PM

My guess would be you're querying using a different encoding and there
really is no data for your query as given.  Hard to say without more
details.

On Wed, Sep 7, 2011 at 8:13 AM, Thamizh <tc...@yahoo.co.in> wrote:
>
> Hi All,
>
> I have created KS & CF using cassandra-0.7.8 and inserted some rows and column values(around 1000 rows). Later, I wanted to index 2 column values. So, I issued 'update column family..' command. After, when I query based on indexed value it says "Row does not found". After indexing 1. Issued nodetool flush 2.restarted Cassandra once. Though it is same. But, I could see some XXX-Index.db file on cassandra data directory. What am I missing?
>
> Here are CF details,
>
> create column family ipinfo with column_type=Standard and
> default_validation_class =   UTF8Type and comparator=UTF8Type and
> keys_cached=25000 and rows_cached=5000 and column_metadata=[
> { column_name : country, validation_class : UTF8Type},
> { column_name : ip, validation_class : LongType},
> { column_name : domain, validation_class : UTF8Type },
> ];
>
> update column family ip with column_type=Standard and
> default_validation_class = UTF8Type and comparator=UTF8Type and
> keys_cached=25000 and rows_cached=5000 and column_metadata=[
> {column_name : country, validation_class : UTF8Type },
> {column_name : domain, validation_class : UTF8Type, index_type: KEYS},
> {column_name : ip, validation_class : LongType, index_type: KEYS}
> ];
>
> Any suggestions would be appreciated
>
> Regards,
> Thamizhannal P


--
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com

Re: Secondary index update issue

Posted by Jonathan Ellis <jb...@gmail.com>.
My guess would be you're querying using a different encoding and there
really is no data for your query as given.  Hard to say without more
details.

On Wed, Sep 7, 2011 at 8:13 AM, Thamizh <tc...@yahoo.co.in> wrote:
>
> Hi All,
>
> I have created KS & CF using cassandra-0.7.8 and inserted some rows and column values(around 1000 rows). Later, I wanted to index 2 column values. So, I issued 'update column family..' command. After, when I query based on indexed value it says "Row does not found". After indexing 1. Issued nodetool flush 2.restarted Cassandra once. Though it is same. But, I could see some XXX-Index.db file on cassandra data directory. What am I missing?
>
> Here are CF details,
>
> create column family ipinfo with column_type=Standard and
> default_validation_class =   UTF8Type and comparator=UTF8Type and
> keys_cached=25000 and rows_cached=5000 and column_metadata=[
> { column_name : country, validation_class : UTF8Type},
> { column_name : ip, validation_class : LongType},
> { column_name : domain, validation_class : UTF8Type },
> ];
>
> update column family ip with column_type=Standard and
> default_validation_class = UTF8Type and comparator=UTF8Type and
> keys_cached=25000 and rows_cached=5000 and column_metadata=[
> {column_name : country, validation_class : UTF8Type },
> {column_name : domain, validation_class : UTF8Type, index_type: KEYS},
> {column_name : ip, validation_class : LongType, index_type: KEYS}
> ];
>
> Any suggestions would be appreciated
>
> Regards,
> Thamizhannal P


--
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com