You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Benjamin Lerer (Jira)" <ji...@apache.org> on 2020/04/09 15:17:00 UTC

[jira] [Commented] (CASSANDRA-13666) Secondary index query on partition key columns might not return partitions with only static data

    [ https://issues.apache.org/jira/browse/CASSANDRA-13666?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17079467#comment-17079467 ] 

Benjamin Lerer commented on CASSANDRA-13666:
--------------------------------------------

[~beobal] I hope you do not mind. I reassigned the ticket to [~Bereng].
My guess was that you were busy with some other tickets.

> Secondary index query on partition key columns might not return partitions with only static data
> ------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-13666
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13666
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Feature/2i Index
>            Reporter: Benjamin Lerer
>            Assignee: Berenguer Blasi
>            Priority: Normal
>
> The problem can be reproduced with the following test in {{3.0}}:
> {code}
>    @Test
>     public void testIndexOnPartitionKeyWithPartitionWithoutRows() throws Throwable
>     {
>         createTable("CREATE TABLE %s (pk1 int, pk2 int, c int, s int static, v int, PRIMARY KEY((pk1, pk2), c))");
>         createIndex("CREATE INDEX ON %s (pk2)");
>         execute("INSERT INTO %s (pk1, pk2, c, s, v) VALUES (?, ?, ?, ?, ?)", 1, 1, 1, 9, 1);
>         execute("INSERT INTO %s (pk1, pk2, c, s, v) VALUES (?, ?, ?, ?, ?)", 1, 1, 2, 9, 2);
>         execute("INSERT INTO %s (pk1, pk2, c, s, v) VALUES (?, ?, ?, ?, ?)", 3, 1, 1, 9, 1);
>         execute("INSERT INTO %s (pk1, pk2, c, s, v) VALUES (?, ?, ?, ?, ?)", 4, 1, 1, 9, 1);
>         flush();
>         assertRows(execute("SELECT * FROM %s WHERE pk2 = ?", 1),
>                    row(1, 1, 1, 9, 1),
>                    row(1, 1, 2, 9, 2),
>                    row(3, 1, 1, 9, 1),
>                    row(4, 1, 1, 9, 1));
>         execute("DELETE FROM %s WHERE pk1 = ? AND pk2 = ? AND c = ?", 3, 1, 1);
>         assertRows(execute("SELECT * FROM %s WHERE pk2 = ?", 1),
>                    row(1, 1, 1, 9, 1),
>                    row(1, 1, 2, 9, 2),
>                    row(3, 1, null, 9, null),  // This row will not be returned
>                    row(4, 1, 1, 9, 1));
>     }
> {code}
> The problem seems to be that the index entries for the static data are inserted with an empty clustering key. When the first {{SELECT}} is executed those entries are removed by {{CompositesSearcher::filterStaleEntries}} which consider that those entries are stales. When the second {{SELECT}} is executed the index ignore the (3, 1) partition as there is not entry for it anymore.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org