cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Konstantin (Jira)" <j...@apache.org>
Subject [jira] [Updated] (CASSANDRA-15345) Incorrect result on conditional UPDATE with static and regular conditions
Date Mon, 07 Oct 2019 12:12:00 GMT

     [ https://issues.apache.org/jira/browse/CASSANDRA-15345?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Konstantin updated CASSANDRA-15345:
-----------------------------------
    Description: 
The below example conditional update is wrongly evaluated to True and applied even though
clustering key 'k1' is not present in the table:

```

{{CREATE KEYSPACE test_keyspace WITH replication = \{'class': 'SimpleStrategy', 'replication_factor':
1};}}
{{ CREATE TABLE test_table (id int, k text, version int static, v text, PRIMARY KEY (id, k));}}
{{ INSERT INTO test_table(id, version) VALUES (0, 0);}}
{{ SELECT * FROM test_table;}}{{id | k | version | v}}
{{ ----++---------------+------}}
{{ 0 | null | 0 | null}}{{(1 rows)}}
{{ SELECT * FROM test_table WHERE id=0 AND k='k1';}}{{id | k | version | v}}
{{ ----++------------+---}}{{(0 rows)}}
{{ UPDATE test_table SET v='foo', version=1 WHERE id=0 AND k='k1' IF version = 0;}}{{[applied]}}
{{ -----------}}
{{ True}}{{SELECT * FROM test_table;}}{{id | k | version | v}}
{{ ----++-------------+-----}}
{{ 0 | k1 | 1 | foo}}{{(1 rows)}}
{{ DROP TABLE test_table;}}
{{ DROP KEYSPACE test_keyspace;}}{{```}}

  was:
The below example conditional update is wrongly evaluated to True and applied even though
clustering key 'k1' is not present in the table:

```

CREATE KEYSPACE test_keyspace WITH replication = \{'class': 'SimpleStrategy', 'replication_factor':
1};
CREATE TABLE test_table (id int, k text, version int static, v text, PRIMARY KEY (id, k));
INSERT INTO test_table(id, version) VALUES (0, 0);
SELECT * FROM test_table;

id | k | version | v
----+------+---------+------
 0 | null | 0 | null

(1 rows)
SELECT * FROM test_table WHERE id=0 AND k='k1';

id | k | version | v
----+---+---------+---

(0 rows)
UPDATE test_table SET v='foo', version=1 WHERE id=0 AND k='k1' IF version = 0;

[applied]
-----------
 True

SELECT * FROM test_table;

id | k | version | v
----+----+---------+-----
 0 | k1 | 1 | foo

(1 rows)
DROP TABLE test_table;
DROP KEYSPACE test_keyspace;

```


> Incorrect result on conditional UPDATE with static and regular conditions
> -------------------------------------------------------------------------
>
>                 Key: CASSANDRA-15345
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-15345
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL/Semantics
>            Reporter: Konstantin
>            Priority: Normal
>
> The below example conditional update is wrongly evaluated to True and applied even though
clustering key 'k1' is not present in the table:
> ```
> {{CREATE KEYSPACE test_keyspace WITH replication = \{'class': 'SimpleStrategy', 'replication_factor':
1};}}
> {{ CREATE TABLE test_table (id int, k text, version int static, v text, PRIMARY KEY (id,
k));}}
> {{ INSERT INTO test_table(id, version) VALUES (0, 0);}}
> {{ SELECT * FROM test_table;}}{{id | k | version | v}}
> {{ ----++---------------+------}}
> {{ 0 | null | 0 | null}}{{(1 rows)}}
> {{ SELECT * FROM test_table WHERE id=0 AND k='k1';}}{{id | k | version | v}}
> {{ ----++------------+---}}{{(0 rows)}}
> {{ UPDATE test_table SET v='foo', version=1 WHERE id=0 AND k='k1' IF version = 0;}}{{[applied]}}
> {{ -----------}}
> {{ True}}{{SELECT * FROM test_table;}}{{id | k | version | v}}
> {{ ----++-------------+-----}}
> {{ 0 | k1 | 1 | foo}}{{(1 rows)}}
> {{ DROP TABLE test_table;}}
> {{ DROP KEYSPACE test_keyspace;}}{{```}}



--
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


Mime
View raw message