Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 978E9200C55 for ; Thu, 13 Apr 2017 10:39:48 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 8FB4D160BA7; Thu, 13 Apr 2017 08:39:48 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B27D0160B8B for ; Thu, 13 Apr 2017 10:39:47 +0200 (CEST) Received: (qmail 71090 invoked by uid 500); 13 Apr 2017 08:39:46 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 71079 invoked by uid 99); 13 Apr 2017 08:39:46 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Apr 2017 08:39:46 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 7298C1AFE3B for ; Thu, 13 Apr 2017 08:39:46 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.201 X-Spam-Level: X-Spam-Status: No, score=-99.201 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id VqHn-a_BSvS3 for ; Thu, 13 Apr 2017 08:39:43 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 786215FCAC for ; Thu, 13 Apr 2017 08:39:43 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 0A5A9E0BCD for ; Thu, 13 Apr 2017 08:39:43 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id C62AC24072 for ; Thu, 13 Apr 2017 08:39:41 +0000 (UTC) Date: Thu, 13 Apr 2017 08:39:41 +0000 (UTC) From: =?utf-8?Q?Andr=C3=A9s_de_la_Pe=C3=B1a_=28JIRA=29?= To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CASSANDRA-13412) Update of column with TTL results in secondary index not returning row MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 13 Apr 2017 08:39:48 -0000 [ https://issues.apache.org/jira/browse/CASSANDRA-13412?page=3Dcom.atla= ssian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId= =3D15967286#comment-15967286 ]=20 Andr=C3=A9s de la Pe=C3=B1a commented on CASSANDRA-13412: ----------------------------------------------- The problem is also affecting to indexes on partition key components: {code} CREATE TABLE k.t ( pk1 int, pk2 int, a int, b int, PRIMARY KEY ((pk1, pk2)) ); CREATE INDEX ON k.t(pk1); INSERT INTO k.t (pk1, pk2, a, b) VALUES (1, 2, 3, 4); UPDATE k.t USING TTL 10 SET b =3D 10 WHERE pk1 =3D 1 AND pk2 =3D 2; -- Wait 10 seconds SELECT * FROM k.t WHERE pk1 =3D 1 AND pk2 =3D 2; -- 1 row SELECT * FROM k.t WHERE pk1 =3D 1; -- 0 rows {code} Index entries inherit the TTL of the indexed cell, and this is right with r= egular columns. However, indexes of primary key columns index every column,= meaning that their index entries will always get the TTL of the last updat= ed row column.=20 The proposed solution is to not generate expiring cells when the indexed co= lumn is part of the primary key. Here is the patch for 2.1 and 2.2: ||[2.1|https://github.com/apache/cassandra/compare/cassandra-2.1...adelapen= a:13412-2.1]|[utests|http://cassci.datastax.com/view/Dev/view/adelapena/job= /adelapena-13412-2.1-testall/]|[dtests|http://cassci.datastax.com/view/Dev/= view/adelapena/job/adelapena-13412-2.1-dtest/]| ||[2.2|https://github.com/apache/cassandra/compare/cassandra-2.2...adelapen= a:13412-2.2]|[utests|http://cassci.datastax.com/view/Dev/view/adelapena/job= /adelapena-13412-2.2-testall/]|[dtests|http://cassci.datastax.com/view/Dev/= view/adelapena/job/adelapena-13412-2.2-dtest/]| > Update of column with TTL results in secondary index not returning row > ---------------------------------------------------------------------- > > Key: CASSANDRA-13412 > URL: https://issues.apache.org/jira/browse/CASSANDRA-1341= 2 > Project: Cassandra > Issue Type: Bug > Reporter: Enrique Bautista Barahona > Assignee: Andr=C3=A9s de la Pe=C3=B1a > > Cassandra versions: 2.2.3, 3.0.11 > 1 datacenter, keyspace has RF 3. Default consistency level. > Steps: > 1. I create these table and index. > {code} > CREATE TABLE my_table ( > a text, > b text, > c text, > d set, > e float, > f text, > g int, > h double, > j set, > k float, > m set, > PRIMARY KEY (a, b, c) > ) WITH read_repair_chance =3D 0.0 > AND dclocal_read_repair_chance =3D 0.1 > AND gc_grace_seconds =3D 864000 > AND bloom_filter_fp_chance =3D 0.01 > AND caching =3D { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' } > AND comment =3D '' > AND compaction =3D { 'class' : 'org.apache.cassandra.db.compaction.Siz= eTieredCompactionStrategy' } > AND compression =3D { 'sstable_compression' : 'org.apache.cassandra.io= .compress.LZ4Compressor' } > AND default_time_to_live =3D 0 > AND speculative_retry =3D '99.0PERCENTILE' > AND min_index_interval =3D 128 > AND max_index_interval =3D 2048; > CREATE INDEX my_index ON my_table (c); > {code} > 2. I have 9951 INSERT statements in a file and I run the following comman= d to execute them. The INSERT statements have no TTL and no consistency lev= el is specified. > {code} > cqlsh -u -f > {code} > 3. I update a column filtering by the whole primary key, and setting a TT= L. For example: > {code} > UPDATE my_table USING TTL 30 SET h =3D 10 WHERE a =3D 'test_a' AND b =3D = 'test_b' AND c =3D 'test_c'; > {code} > 4. After the time specified in the TTL I run the following queries: > {code} > SELECT * FROM my_table WHERE a =3D 'test_a' AND b =3D 'test_b' AND c =3D = 'test_c'; > SELECT * FROM my_table WHERE c =3D 'test_c'; > {code} > The first one returns the correct row with an empty h column (as it has e= xpired). However, the second query (which uses the secondary index on colum= n c) returns nothing. > I've done the query through my app which uses the Java driver v3.0.4 and = reads with CL local_one, from the cql shell and from DBeaver 3.8.5. All dis= play the same behaviour. The queries are performed minutes after the writes= and the servers don't have a high load, so I think it's unlikely to be a c= onsistency issue. > I've tried to reproduce the issue in ccm and cqlsh by creating a new keys= pace and table, and inserting just 1 row, and the bug doesn't manifest. Thi= s leads me to think that it's an issue only present with not trivially smal= l amounts of data, or maybe present only after Cassandra compacts or perfor= ms whatever maintenance it needs to do. -- This message was sent by Atlassian JIRA (v6.3.15#6346)