Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6434E18CB0 for ; Wed, 11 Nov 2015 16:16:12 +0000 (UTC) Received: (qmail 42323 invoked by uid 500); 11 Nov 2015 16:16:12 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 42274 invoked by uid 500); 11 Nov 2015 16:16:12 -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 41993 invoked by uid 99); 11 Nov 2015 16:16:11 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Nov 2015 16:16:11 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 8A4112C1F92 for ; Wed, 11 Nov 2015 16:16:11 +0000 (UTC) Date: Wed, 11 Nov 2015 16:16:11 +0000 (UTC) From: "Aleksey Yeschenko (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CASSANDRA-8505) Invalid results are returned while secondary index are being build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CASSANDRA-8505?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Aleksey Yeschenko updated CASSANDRA-8505: ----------------------------------------- Component/s: Coordination > Invalid results are returned while secondary index are being build > ------------------------------------------------------------------ > > Key: CASSANDRA-8505 > URL: https://issues.apache.org/jira/browse/CASSANDRA-8505 > Project: Cassandra > Issue Type: Bug > Components: Coordination > Reporter: Benjamin Lerer > Assignee: Benjamin Lerer > Fix For: 2.2.x, 3.0.x > > > If you request an index creation and then execute a query that use the index the results returned might be invalid until the index is fully build. This is caused by the fact that the table column will be marked as indexed before the index is ready. > The following unit tests can be use to reproduce the problem: > {code} > @Test > public void testIndexCreatedAfterInsert() throws Throwable > { > createTable("CREATE TABLE %s (a int, b int, c int, primary key((a, b)))"); > execute("INSERT INTO %s (a, b, c) VALUES (0, 0, 0);"); > execute("INSERT INTO %s (a, b, c) VALUES (0, 1, 1);"); > execute("INSERT INTO %s (a, b, c) VALUES (0, 2, 2);"); > execute("INSERT INTO %s (a, b, c) VALUES (1, 0, 3);"); > execute("INSERT INTO %s (a, b, c) VALUES (1, 1, 4);"); > > createIndex("CREATE INDEX ON %s(b)"); > > assertRows(execute("SELECT * FROM %s WHERE b = ?;", 1), > row(0, 1, 1), > row(1, 1, 4)); > } > > @Test > public void testIndexCreatedBeforeInsert() throws Throwable > { > createTable("CREATE TABLE %s (a int, b int, c int, primary key((a, b)))"); > createIndex("CREATE INDEX ON %s(b)"); > > execute("INSERT INTO %s (a, b, c) VALUES (0, 0, 0);"); > execute("INSERT INTO %s (a, b, c) VALUES (0, 1, 1);"); > execute("INSERT INTO %s (a, b, c) VALUES (0, 2, 2);"); > execute("INSERT INTO %s (a, b, c) VALUES (1, 0, 3);"); > execute("INSERT INTO %s (a, b, c) VALUES (1, 1, 4);"); > assertRows(execute("SELECT * FROM %s WHERE b = ?;", 1), > row(0, 1, 1), > row(1, 1, 4)); > } > {code} > The first test will fail while the second will work. > In my opinion the first test should reject the request as invalid (as if the index was not existing) until the index is fully build. -- This message was sent by Atlassian JIRA (v6.3.4#6332)