You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Andres de la Peña (Jira)" <ji...@apache.org> on 2020/04/28 12:38:00 UTC

[jira] [Commented] (CASSANDRA-15503) Slow query log indicates opposite LTE when GTE operator

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

Andres de la Peña commented on CASSANDRA-15503:
-----------------------------------------------

The reversed inequalities are caused by the {{DESC}} clustering order used by the table. [{{Slices.ArrayBackedSlices#toCQLString}}|https://github.com/apache/cassandra/blob/cassandra-3.10/src/java/org/apache/cassandra/db/Slices.java#L623] doesn't take into account that in case of reverse order the operators are internally reversed.

As for the strict equality, there seems to be a mistake at the beginning of  [{{ClusteringIndexNamesFilter#toCQLString}}|https://github.com/apache/cassandra/blob/cassandra-3.10/src/java/org/apache/cassandra/db/filter/ClusteringIndexNamesFilter.java#L192], where clustering restrictions with a single clustering or empty are not printed. This was introduced by CASSANDRA-7392, specifically in [this commit|https://github.com/stef1927/cassandra/commit/27962122243d41d0bc994eccb84970dcba14306d]. I think that they should not be printed only if there are no clusterings at all.

Here is a patch addressing both problems:
||branch||PR||utest||dtest||
|3.11|[568|https://github.com/apache/cassandra/pull/568]|[67|https://ci-cassandra.apache.org/job/Cassandra-devbranch-test/67/]|[88|https://ci-cassandra.apache.org/job/Cassandra-devbranch-dtest/88/]|
|trunk|[569|https://github.com/apache/cassandra/pull/569]|[68|https://ci-cassandra.apache.org/job/Cassandra-devbranch-test/68/]|[89|https://ci-cassandra.apache.org/job/Cassandra-devbranch-dtest/89/]|
|dtest|[67|https://github.com/apache/cassandra-dtest/pull/67]|


> Slow query log indicates opposite LTE when GTE operator
> -------------------------------------------------------
>
>                 Key: CASSANDRA-15503
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-15503
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Observability/Logging
>            Reporter: Wallace Baggaley
>            Assignee: Andres de la Peña
>            Priority: Normal
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Slow query log is indicating a '<=' when a ">=" operator was sent. This appears to be a logging only issue, but it threw off development for a day figuring this out. Please fix.
> How to reproduce. Set slow query log timeout to 1 millisecond.
> In cqlsh run
> {noformat}
> CREATE TABLE atable (
>       .id text,
>       timestamp timestamp,
>       PRIMARY KEY ((id), timestamp)
>  ) WITH CLUSTERING ORDER BY (timestamp DESC);
> insert into atable (id, timestamp) VALUES ( '1',1);
> insert into atable (id, timestamp) VALUES ( '2',2);
> insert into atable (id, timestamp) VALUES ( '3',3);
> insert into atable (id, timestamp) VALUES ( '4',4);
> insert into atable (id, timestamp) VALUES ( '5',5);
> insert into atable (id, timestamp) VALUES ( '6',6);
> insert into atable (id, timestamp) VALUES ( '7',7);
> insert into atable (id, timestamp) VALUES ( '8',8);
> insert into atable (id, timestamp) VALUES ( '9',9);
> insert into atable (id, timestamp) VALUES ( '10',10);
> insert into atable (id, timestamp) VALUES ( '11',11);
> select * from atable where timestamp >= '1970-01-01 00:00:00.006+0000' allow filtering;
> {noformat}
> In the logs it prints:
> {noformat}
> DEBUG 1 operations were slow in the last 5003 msecs:
> <SELECT * FROM ks.atable WHERE timestamp <= 1970-01-01 00:00Z LIMIT 100>, time 7 msec - slow timeout 1 msec
> {noformat}
> But the query works appropriately and returns
> {noformat}
>  id | timestamp
> ----+---------------------------------
>   6 | 1970-01-01 00:00:00.006000+0000
>   7 | 1970-01-01 00:00:00.007000+0000
>   9 | 1970-01-01 00:00:00.009000+0000
>  10 | 1970-01-01 00:00:00.010000+0000
>   8 | 1970-01-01 00:00:00.008000+0000
>  11 | 1970-01-01 00:00:00.011000+0000
> (6 rows)
> {noformat}



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