You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Romain Hardouin (JIRA)" <ji...@apache.org> on 2017/02/27 18:07:45 UTC
[jira] [Created] (CASSANDRA-13277) Duplicate results with secondary
index on static column
Romain Hardouin created CASSANDRA-13277:
-------------------------------------------
Summary: 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
Reporter: Romain Hardouin
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
(v6.3.15#6346)