You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Leena Ghatpande <lg...@hotmail.com> on 2014/03/13 18:38:23 UTC
Issue - Creation of Secondary Index on Existing Data results in NO
ROWS returned
We have Cassandra Version 1.2.15 and 1.2.9 and we have this issue on both the version.
We have a Cassandra Column Family with 3000 rows. We created a secondary Index on the table. When we try to select the data for existing rows using the Secondary Key, it returns no rows, even though we see the data using the Primary Key. The select on Secondary Indexes works for ALL NEW rows added after index creation. We have tried Cassandra restart, Nodetool repair, rebuild_indexes on all nodes and it does not fix the issue.
We have assumed all data will be Indexed when you create a Secondary Index on existing data. Can you please provide a resolution for this issue.
Below is the table and the index.
CREATE TABLE streams (
id uuid,
time timestamp,
itemid timeuuid,
PRIMARY KEY (id, time)
) WITH CLUSTERING ORDER BY (time DESC) AND
bloom_filter_fp_chance=0.010000 AND
caching='KEYS_ONLY' AND
comment='' AND
dclocal_read_repair_chance=0.000000 AND
gc_grace_seconds=864000 AND
read_repair_chance=0.100000 AND
replicate_on_write='true' AND
populate_io_cache_on_flush='false' AND
compaction={'class': 'SizeTieredCompactionStrategy'} AND
compression={'sstable_compression': 'SnappyCompressor'};
CREATE INDEX streams_idx_1 ON streams (itemid);
Result set returned using the Primary Key ID.
Select * from streams where id = 7d07a751-8570-4439-be8f-693ffa969a3b;
7d07a751-8570-4439-be8f-693ffa969a3b | 2014-01-20 14:21:00Eastern Standard Time | 18b78540-8203-11e3-b3af-55bb82e94e0d
7d07a751-8570-4439-be8f-693ffa969a3b | 2014-01-20 14:21:00Eastern Standard Time | 18b78540-8203-11e3-b3af-55bb82e94e0d
7d07a751-8570-4439-be8f-693ffa969a3b | 2014-01-20 14:20:07Eastern Standard Time | 18b78540-8203-11e3-b3af-55bb82e94e0d
7d07a751-8570-4439-be8f-693ffa969a3b | 2014-01-20 14:20:07Eastern Standard Time | 18b78540-8203-11e3-b3af-55bb82e94e0d
7d07a751-8570-4439-be8f-693ffa969a3b | 2014-01-20 13:47:17Eastern Standard Time | 18b78540-8203-11e3-b3af-55bb82e94e0d
7d07a751-8570-4439-be8f-693ffa969a3b | 2014-01-20 13:47:17Eastern Standard Time | 18b78540-8203-11e3-b3af-55bb82e94e0d
7d07a751-8570-4439-be8f-693ffa969a3b | 2014-01-20 13:45:56Eastern Standard Time | 18b78540-8203-11e3-b3af-55bb82e94e0d
Select * from streams where id = 7d07a751-8570-4439-be8f-693ffa969a3b and itemid=18b78540-8203-11e3-b3af-55bb82e94e0d;
No Rows Returned.
Leena
Re: Issue - Creation of Secondary Index on Existing Data results in
NO ROWS returned
Posted by Russell Hatch <rh...@datastax.com>.
I did some quick testing to try and reproduce the issue you are seeing
(using 1.2.15). I wasn't able to get the same issue to happen though. You
are correct that normally the pre-existing values would be indexed and
searchable. You may want to search JIRA to see if anyone else has had the
issue, and open a new ticket if this has not been reported. It may also be
helpful to have a look at the logs for your cluster to see if there's
anything unusual.
Cheers,
Russ
On Thu, Mar 13, 2014 at 11:38 AM, Leena Ghatpande <lg...@hotmail.com>wrote:
> We have Cassandra Version 1.2.15 and 1.2.9 and we have this issue on both
> the version.
>
> We have a Cassandra Column Family with 3000 rows. We created a secondary
> Index on the table. When we try to select the data for existing rows using
> the Secondary Key, it returns no rows, even though we see the data using
> the Primary Key. The select on Secondary Indexes works for ALL NEW rows
> added after index creation. We have tried Cassandra restart, Nodetool
> repair, rebuild_indexes on all nodes and it does not fix the issue.
>
>
>
> We have assumed all data will be Indexed when you create a Secondary Index
> on existing data. Can you please provide a resolution for this issue.
>
>
>
> Below is the table and the index.
>
> CREATE TABLE streams (
>
> id uuid,
>
> time timestamp,
>
> itemid timeuuid,
>
> PRIMARY KEY (id, time)
>
> ) WITH CLUSTERING ORDER BY (time DESC) AND
>
> bloom_filter_fp_chance=0.010000 AND
>
> caching='KEYS_ONLY' AND
>
> comment='' AND
>
> dclocal_read_repair_chance=0.000000 AND
>
> gc_grace_seconds=864000 AND
>
> read_repair_chance=0.100000 AND
>
> replicate_on_write='true' AND
>
> populate_io_cache_on_flush='false' AND
>
> compaction={'class': 'SizeTieredCompactionStrategy'} AND
>
> compression={'sstable_compression': 'SnappyCompressor'};
>
>
>
> CREATE INDEX streams_idx_1 ON streams (itemid);
>
>
>
> Result set returned using the Primary Key ID.
>
> *Select * from streams where id = 7d07a751-8570-4439-be8f-693ffa969a3b;*
>
> 7d07a751-8570-4439-be8f-693ffa969a3b | 2014-01-20 14:21:00Eastern Standard
> Time | 18b78540-8203-11e3-b3af-55bb82e94e0d
>
> 7d07a751-8570-4439-be8f-693ffa969a3b | 2014-01-20 14:21:00Eastern Standard
> Time | 18b78540-8203-11e3-b3af-55bb82e94e0d
>
> 7d07a751-8570-4439-be8f-693ffa969a3b | 2014-01-20 14:20:07Eastern Standard
> Time | 18b78540-8203-11e3-b3af-55bb82e94e0d
>
> 7d07a751-8570-4439-be8f-693ffa969a3b | 2014-01-20 14:20:07Eastern Standard
> Time | 18b78540-8203-11e3-b3af-55bb82e94e0d
>
> 7d07a751-8570-4439-be8f-693ffa969a3b | 2014-01-20 13:47:17Eastern Standard
> Time | 18b78540-8203-11e3-b3af-55bb82e94e0d
>
> 7d07a751-8570-4439-be8f-693ffa969a3b | 2014-01-20 13:47:17Eastern Standard
> Time | 18b78540-8203-11e3-b3af-55bb82e94e0d
>
> 7d07a751-8570-4439-be8f-693ffa969a3b | 2014-01-20 13:45:56Eastern Standard
> Time | 18b78540-8203-11e3-b3af-55bb82e94e0d
>
>
>
> *Select * from streams where id = 7d07a751-8570-4439-be8f-693ffa969a3b and
> itemid=18b78540-8203-11e3-b3af-55bb82e94e0d;*
>
> No Rows Returned.
>
>
>
> Leena
>