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