Details
-
Bug
-
Status: Resolved
-
Normal
-
Resolution: Fixed
-
Normal
Description
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:
Traceback (most recent call last): File "bin/cqlsh.py", line 1246, in perform_simple_statement result = future.result() File "/Users/adelapena/stratio/platform/src/cassandra-3.2.1/bin/../lib/cassandra-driver-internal-only-3.0.0-6af642d.zip/cassandra-driver-3.0.0-6af642d/cassandra/cluster.py", 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'}
I attach a dummy index implementation to reproduce the error:
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');
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.