Skip to content

Commit

Permalink
Merge 'cql-pytest/lwt_test: test LWT UPDATE when partition/clustering…
Browse files Browse the repository at this point in the history
… ranges are empty' from Jan Ciołek

Adds two test cases which test what happens when we perform an LWT UPDATE, but the partition/clustering key has 0 possible values. This can happen e.g when a column is supposed to be equal to two different values (`c = 0 AND c = 1`).

Empty partition ranges work properly, empty clustering range currently causes a crash (#13129).
I added tests for both of these cases.

Closes #13130

* github.com:scylladb/scylladb:
  cql-pytest/test_lwt: test LWT update with empty clustering range
  cql-pytest/test_lwt: test LWT update with empty partition range
  • Loading branch information
nyh committed Mar 12, 2023
2 parents 53c8c43 + e4a3e2a commit e72b85e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/cql-pytest/test_lwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,18 @@ def test_lwt_static_condition(cql, table1):
# respectively.
with pytest.raises(InvalidRequest, match=re.compile('missing', re.IGNORECASE)):
cql.execute(f'UPDATE {table1} SET s=2 WHERE p={p} IF r=1')

# Generate an LWT update where there is no value for the partition key,
# as the WHERE restricts it using `p = {p} AND p = {p+1}`.
# Such quries are rejected.
def test_lwt_empty_partition_range(cql, table1):
with pytest.raises(InvalidRequest):
cql.execute(f"UPDATE {table1} SET r = 9000 WHERE p = 1 AND p = 1000 AND c = 2 IF r = 3")

# Generate an LWT update where there is no value for the clustering key,
# as the WHERE restricts it using `c = 2 AND c = 3`.
# Such queries are rejected.
@pytest.mark.skip(reason="crashes scylla, see issue #13129")
def test_lwt_empty_clustering_range(cql, table1):
with pytest.raises(InvalidRequest):
cql.execute(f"UPDATE {table1} SET r = 9000 WHERE p = 1 AND c = 2 AND c = 2000 IF r = 3")

0 comments on commit e72b85e

Please sign in to comment.