incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kam Nob <goodin...@gmail.com>
Subject adding secondary index via updating column families seems to not working
Date Mon, 30 Jul 2012 04:55:42 GMT
Hi
I'm trying to add a secondary index to one of my columns in a column family
but however I try I got the error that the column that I'm trying to put it
in the "where" clause has no index. First I tried to add index to the
"starttime" column in "alerts" column family with this command in
cassandra-cli:

update column family alerts with column_metadata=[{ column_name : id,
validation_class : LongType, index_name : didindex, index_type : KEYS} {
column_name : starttime, validation_class : DateType, index_name :
starttimeindex, index_type : KEYS} {column_name : endtime, validation_class
: DateType} {column_name : name, validation_class : AsciiType}];

Then because I have had data on this schema (about 30GB) I also did the
"nodetool scrub". It took a long time (about one day) and meanwhile I
observed via "nodetool compactstats" that its building a "seconday index".
but after that whenever I query the column family in cassandra-cli with
"get alerts where starttime>1000;" I got the error that "No indexed columns
present in index clause with operator EQ".
And this is the report that "describe alerts" shows me:
ColumnFamily: alerts
      Key Validation Class: org.apache.cassandra.db.marshal.BytesType
      Default column value validator:
org.apache.cassandra.db.marshal.BytesType
      Columns sorted by: org.apache.cassandra.db.marshal.AsciiType
      GC grace seconds: 864000
      Compaction min/max thresholds: 4/32
      Read repair chance: 0.1
      DC Local Read repair chance: 0.0
      Replicate on write: true
      Caching: KEYS_ONLY
      Bloom Filter FP chance: default
      Built indexes: [alerts.idindex]
      Column Metadata:
        Column Name: id
          Validation Class: org.apache.cassandra.db.marshal.LongType
          Index Name: compressedidindex
          Index Type: KEYS
        Column Name: starttime
          Validation Class: org.apache.cassandra.db.marshal.DateType
        Column Name: name
      Compaction Strategy:
org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy
      Compression Options:
        sstable_compression:
org.apache.cassandra.io.compress.DeflateCompressor
As you see there is no "starttimeindex" in that.
I have also tried all of this with hector and it was same. the code for
query was:

IndexedSlicesQuery isq = new IndexedSlicesQuery(keyspace,
LongSerializer.get(), AsciiSerializer.get(), LongSerializer.get());

isq.setColumnFamily("alerts").setColumnNames("starttime").addEqualsExpression("starttime",
new GregorianCalendar(2012, 7, 24, 9, 1,
0).getTimeInMillis()).setStartKey((long) 0)
        QueryResult execute = isq.execute();

and I get the exception that:
Exception in thread "main"
me.prettyprint.hector.api.exceptions.HInvalidRequestException:
InvalidRequestException(why:No indexed columns present in index clause with
operator EQ)

I'm using cassandra 1.1.2.
How Cassandra doesn't respond to my queries, and as I'm sure it did make
the indexes why it doesn't put it on work?

Mime
View raw message