[ https://issues.apache.org/jira/browse/CASSANDRA-13277?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Josh McKenzie updated CASSANDRA-13277: -------------------------------------- Bug Category: Parent values: Correctness(12982)Level 1 values: API / Semantic Implementation(12988) > Duplicate results with secondary index on static column > ------------------------------------------------------- > > Key: CASSANDRA-13277 > URL: https://issues.apache.org/jira/browse/CASSANDRA-13277 > Project: Cassandra > Issue Type: Bug > Components: Feature/2i Index, Legacy/Local Write-Read Paths > Reporter: Romain Hardouin > Assignee: Andres de la Peña > Priority: Normal > Labels: 2i > Fix For: 3.11.0, 4.0 > > > As a follow up of > http://www.mail-archive.com/user@cassandra.apache.org/msg50816.html > Duplicate results appear with secondary index on static column with RF > 1. > Number of results vary depending on consistency level. > Here is a CCM session to reproduce the issue: > {code} > romain@debian:~$ ccm create 39 -n 3 -v 3.9 -s > Current cluster is now: 39 > romain@debian:~$ ccm node1 cqlsh > Connected to 39 at 127.0.0.1:9042. > [cqlsh 5.0.1 | Cassandra 3.9 | CQL spec 3.4.2 | Native protocol v4] > Use HELP for help. > cqlsh> CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', > 'replication_factor': 2}; > cqlsh> CREATE TABLE test.idx_static (id text, id2 bigint static, added > timestamp, source text static, dest text, primary key (id, added)); > cqlsh> CREATE index ON test.idx_static (id2); > cqlsh> INSERT INTO test.idx_static (id, id2, added, source, dest) values > ('id1', 22,'2017-01-28', 'src1', 'dst1'); > cqlsh> SELECT * FROM test.idx_static where id2=22; > id | added | id2 | source | dest > -----+---------------------------------+-----+--------+------ > id1 | 2017-01-27 23:00:00.000000+0000 | 22 | src1 | dst1 > id1 | 2017-01-27 23:00:00.000000+0000 | 22 | src1 | dst1 > (2 rows) > cqlsh> CONSISTENCY ALL > Consistency level set to ALL. > cqlsh> SELECT * FROM test.idx_static where id2=22; > id | added | id2 | source | dest > -----+---------------------------------+-----+--------+------ > id1 | 2017-01-27 23:00:00.000000+0000 | 22 | src1 | dst1 > id1 | 2017-01-27 23:00:00.000000+0000 | 22 | src1 | dst1 > id1 | 2017-01-27 23:00:00.000000+0000 | 22 | src1 | dst1 > (3 rows) > {code} > When RF matches the number of nodes, it works as expected. > Example with RF=3 and 3 nodes: > {code} > romain@debian:~$ ccm create 39 -n 3 -v 3.9 -s > Current cluster is now: 39 > romain@debian:~$ ccm node1 cqlsh > Connected to 39 at 127.0.0.1:9042. > [cqlsh 5.0.1 | Cassandra 3.9 | CQL spec 3.4.2 | Native protocol v4] > Use HELP for help. > cqlsh> CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', > 'replication_factor': 3}; > cqlsh> CREATE TABLE test.idx_static (id text, id2 bigint static, added > timestamp, source text static, dest text, primary key (id, added)); > cqlsh> CREATE index ON test.idx_static (id2); > cqlsh> INSERT INTO test.idx_static (id, id2, added, source, dest) values > ('id1', 22,'2017-01-28', 'src1', 'dst1'); > cqlsh> SELECT * FROM test.idx_static where id2=22; > id | added | id2 | source | dest > -----+---------------------------------+-----+--------+------ > id1 | 2017-01-27 23:00:00.000000+0000 | 22 | src1 | dst1 > (1 rows) > cqlsh> CONSISTENCY all > Consistency level set to ALL. > cqlsh> SELECT * FROM test.idx_static where id2=22; > id | added | id2 | source | dest > -----+---------------------------------+-----+--------+------ > id1 | 2017-01-27 23:00:00.000000+0000 | 22 | src1 | dst1 > (1 rows) > {code} > Example with RF = 2 and 2 nodes: > {code} > romain@debian:~$ ccm create 39 -n 2 -v 3.9 -s > Current cluster is now: 39 > romain@debian:~$ ccm node1 cqlsh > Connected to 39 at 127.0.0.1:9042. > [cqlsh 5.0.1 | Cassandra 3.9 | CQL spec 3.4.2 | Native protocol v4] > Use HELP for help. > cqlsh> CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', > 'replication_factor': 2}; > cqlsh> CREATE TABLE test.idx_static (id text, id2 bigint static, added > timestamp, source text static, dest text, primary key (id, added)); > cqlsh> INSERT INTO test.idx_static (id, id2, added, source, dest) values > ('id1', 22,'2017-01-28', 'src1', 'dst1'); > cqlsh> CREATE index ON test.idx_static (id2); > cqlsh> INSERT INTO test.idx_static (id, id2, added, source, dest) values > ('id1', 22,'2017-01-28', 'src1', 'dst1'); > cqlsh> SELECT * FROM test.idx_static where id2=22; > id | added | id2 | source | dest > -----+---------------------------------+-----+--------+------ > id1 | 2017-01-27 23:00:00.000000+0000 | 22 | src1 | dst1 > (1 rows) > cqlsh> CONSISTENCY ALL > Consistency level set to ALL. > cqlsh> SELECT * FROM test.idx_static where id2=22; > id | added | id2 | source | dest > -----+---------------------------------+-----+--------+------ > id1 | 2017-01-27 23:00:00.000000+0000 | 22 | src1 | dst1 > (1 rows) > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org