Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A1A3D925C for ; Mon, 30 Jul 2012 04:56:34 +0000 (UTC) Received: (qmail 29318 invoked by uid 500); 30 Jul 2012 04:56:32 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 29294 invoked by uid 500); 30 Jul 2012 04:56:31 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 29279 invoked by uid 99); 30 Jul 2012 04:56:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Jul 2012 04:56:31 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FSL_RCVD_USER,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of goodinges@gmail.com designates 209.85.220.172 as permitted sender) Received: from [209.85.220.172] (HELO mail-vc0-f172.google.com) (209.85.220.172) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Jul 2012 04:56:23 +0000 Received: by vcbfo14 with SMTP id fo14so4468606vcb.31 for ; Sun, 29 Jul 2012 21:56:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=tBM/IWQNeIdQL+vjc+y6Y/DVYhU5CIkk5oUL/3GlsBY=; b=zl0p6ySov1aB7jGjR+vNl/8/u7P8QPwvVrRFNIjFZnZOw7+0tFaKePLZnPs0qipEdd VBOzxvGJ+15l0oo4cWLbBTgIW5A2DRR7flSVMKwxARvSps3K9TuHoaqy673L38kYAupg vEiaqX9ax2H3h/OEwjpdD1pL9zCIPrfUVBsKngLvpqgkGaqt/faRQR/EtqRe08oaU8HE LqKQSX9wJOW1n4EDbWmitwbHmVbWEHrZWZwOpsVArxUnPAtQPW9VNzR4Z/FRTXzpDUrj RU0QCSQmexshawgIuqV+ybcWK13zyLgm6aZFS/7sin+f3wNt/DpYUIqIKR4O4WHtJjQQ UQiA== Received: by 10.52.240.228 with SMTP id wd4mr8475497vdc.95.1343624162821; Sun, 29 Jul 2012 21:56:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.58.246.73 with HTTP; Sun, 29 Jul 2012 21:55:42 -0700 (PDT) In-Reply-To: References: From: Kam Nob Date: Mon, 30 Jul 2012 09:25:42 +0430 Message-ID: Subject: adding secondary index via updating column families seems to not working To: user Content-Type: multipart/alternative; boundary=20cf307d008aefc75504c604e0d8 --20cf307d008aefc75504c604e0d8 Content-Type: text/plain; charset=ISO-8859-1 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? --20cf307d008aefc75504c604e0d8 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
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 tha= t 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" colum= n in "alerts" column family with this command in cassandra-cli:
update column family alerts with column_metadata=3D[{ column_name : id,= validation_class : LongType, index_name : didindex, index_type : KEYS} { c= olumn_name : starttime, validation_class : DateType, index_name : starttime= index, index_type : KEYS} {column_name : endtime, validation_class : DateTy= pe} {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 meanwh= ile I observed via "nodetool compactstats" that its building a &q= uot;seconday index". but after that whenever I query the column family= in cassandra-cli with "get alerts where starttime>1000;" I go= t the error that "No indexed columns present in index clause with oper= ator EQ".
And this is the report that "describe alerts" shows me:
Column= Family: alerts
=A0=A0=A0=A0=A0 Key Validation Class: org.apache.cassandr= a.db.marshal.BytesType
=A0=A0=A0=A0=A0 Default column value validator: o= rg.apache.cassandra.db.marshal.BytesType
=A0=A0=A0=A0=A0 Columns sorted by: org.apache.cassandra.db.marshal.AsciiTyp= e
=A0=A0=A0=A0=A0 GC grace seconds: 864000
=A0=A0=A0=A0=A0 Compaction= min/max thresholds: 4/32
=A0=A0=A0=A0=A0 Read repair chance: 0.1
=A0= =A0=A0=A0=A0 DC Local Read repair chance: 0.0
=A0=A0=A0=A0=A0 Replicate on write: true
=A0=A0=A0=A0=A0 Caching: KEYS_O= NLY
=A0=A0=A0=A0=A0 Bloom Filter FP chance: default
=A0=A0=A0=A0=A0 B= uilt indexes: [alerts.idindex]
=A0=A0=A0=A0=A0 Column Metadata:
=A0= =A0=A0=A0=A0=A0=A0 Column Name: id
=A0=A0=A0=A0=A0=A0=A0=A0=A0 Validatio= n Class: org.apache.cassandra.db.marshal.LongType
=A0=A0=A0=A0=A0=A0=A0=A0=A0 Index Name: compressedidindex
=A0=A0=A0=A0= =A0=A0=A0=A0=A0 Index Type: KEYS
=A0=A0=A0=A0=A0=A0=A0 Column Name: star= ttime
=A0=A0=A0=A0=A0=A0=A0=A0=A0 Validation Class: org.apache.cassandra= .db.marshal.DateType
=A0=A0=A0=A0=A0=A0=A0 Column Name: name
=A0=A0= =A0=A0=A0 Compaction Strategy: org.apache.cassandra.db.compaction.SizeTiere= dCompactionStrategy
=A0=A0=A0=A0=A0 Compression Options:
=A0=A0=A0=A0=A0=A0=A0 sstable_compr= ession: org.apache.cassandra.io.compress.DeflateCompressor
As you see th= ere is no "starttimeindex" in that.
I have also tried all of t= his with hector and it was same. the code for query was:

IndexedSlicesQuery isq =3D new IndexedSlicesQuery(keyspace, LongSeriali= zer.get(), AsciiSerializer.get(), LongSerializer.get());
=A0=A0=A0=A0=A0= =A0=A0 isq.setColumnFamily("alerts").setColumnNames("startti= me").addEqualsExpression("starttime", new GregorianCalendar(= 2012, 7, 24, 9, 1, 0).getTimeInMillis()).setStartKey((long) 0)
=A0=A0=A0=A0=A0=A0=A0 QueryResult execute =3D isq.execute();

and I g= et the exception that:
Exception in thread "main" me.prettypri= nt.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?




--20cf307d008aefc75504c604e0d8--