The Cassandra 2.0 doc says that “Indexes are built in the background 
automatically, without blocking reads or writes.” IOW, no guarantee that the 2i 
will have been updated by the time you attempt a query on it. A GC or just 
general busyness of the node could delay the 2i update, even though it may 
generally complete quicker than you can do a query.

See:
http://www.datastax.com/documentation/cql/3.1/cql/ddl/ddl_build_index_c.html

AFAICT, there is no mechanism for guaranteeing that a 2i has been updated.

-- Jack Krupansky

From: Tom van den Berge 
Sent: Thursday, June 19, 2014 5:26 AM
To: user@cassandra.apache.org 
Subject: Are writes to indexes performed asynchronously?

Hi,

I have a column family with a secondary index on one of its columns. I noticed 
that when I write a row to the column family, and immediately query that row 
through the secondary index, every now and then it won't give any results.

Could it be that Cassandra performs the write to the internal index column 
family asynchronously? That might explain this behaviour. 

In other words, when writing to a indexed column family, is there, or can there 
be any guarantee that the write to index is completed when the write to the 
original column family is completed?

I'm using a single-node cluster, with consistency level ONE.

Thanks,
Tom

Reply via email to