cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrés de la Peña (JIRA) <>
Subject [jira] [Reopened] (CASSANDRA-11043) Secondary indexes doesn't properly validate custom expressions
Date Tue, 19 Apr 2016 16:09:25 GMT


Andrés de la Peña reopened CASSANDRA-11043:
    Reproduced In: 3.5, 3.0.5  (was: 3.2.1)

The validation method works great with CQL queries producing a {{PartitionRangeReadCommand}},
but it is not called with CQL queries producing one or more {{SinglePartitionReadCommand}}.

For example, the following query properly validates the expression:
SELECT * FROM test WHERE expr(test_idx, 'error');
However the following queries skip validation:
SELECT * FROM test WHERE expr(test_idx, 'error') AND id=1;
SELECT * FROM test WHERE expr(test_idx, 'error') AND id IN (1,2);

> Secondary indexes doesn't properly validate custom expressions
> --------------------------------------------------------------
>                 Key: CASSANDRA-11043
>                 URL:
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL, Local Write-Read Paths
>            Reporter: Andrés de la Peña
>            Assignee: Sam Tunnicliffe
>              Labels: 2i, index, validation
>             Fix For: 3.0.4, 3.4
>         Attachments:
> It seems that [CASSANDRA-7575|] is
broken in Cassandra 3.x. As stated in the secondary indexes' API documentation, custom index
implementations should perform any validation of query expressions at {{Index#searcherFor(ReadCommand)}},
throwing an {{InvalidRequestException}} if the expressions are not valid. I assume these validation
errors should produce an {{InvalidRequest}} error on cqlsh, or raise an {{InvalidQueryException}}
on Java driver. However, when {{Index#searcherFor(ReadCommand)}} throws its {{InvalidRequestException}},
I get this cqlsh output:
> {noformat}
> Traceback (most recent call last):
>   File "bin/", line 1246, in perform_simple_statement
>     result = future.result()
>   File "/Users/adelapena/stratio/platform/src/cassandra-3.2.1/bin/../lib/",
line 3122, in result
>     raise self._final_exception
> ReadFailure: code=1300 [Replica(s) failed to execute read] message="Operation failed
- received 0 responses and 1 failures" info={'failures': 1, 'received_responses': 0, 'required_responses':
1, 'consistency': 'ONE'}
> {noformat}
> I attach a dummy index implementation to reproduce the error:
> {noformat}
> CREATE KEYSPACE test with replication = {'class' : 'SimpleStrategy', 'replication_factor'
: '1' }; 
> CREATE TABLE test.test (id int PRIMARY KEY, value varchar); 
> CREATE CUSTOM INDEX test_index ON test.test() USING 'com.stratio.TestIndex'; 
> SELECT * FROM test.test WHERE expr(test_index,'ok');
> SELECT * FROM test.test WHERE expr(test_index,'error');
> {noformat}
> This is specially problematic when using Cassandra Java Driver, because one of these
server exceptions can produce subsequent queries fail (even if they are valid) with a no host
available exception.
> Maybe the validation method added with [CASSANDRA-7575|]
should be restored, unless there is a way to properly manage the exception.

This message was sent by Atlassian JIRA

View raw message