maedhroz commented on code in PR #2961:
URL: https://github.com/apache/cassandra/pull/2961#discussion_r1434432867
##########
src/java/org/apache/cassandra/cql3/statements/SelectStatement.java:
##########
@@ -404,7 +404,12 @@ public ReadQuery getQuery(QueryOptions options,
boolean isPartitionRangeQuery = restrictions.isKeyRange() ||
restrictions.usesSecondaryIndexing();
if (isPartitionRangeQuery)
+ {
+ if (restrictions.usesSecondaryIndexing() &&
!SchemaConstants.isLocalSystemKeyspace(table.keyspace))
+
Guardrails.nonPartitionRestrictedIndexQueryEnabled.ensureEnabled(state);
Review Comment:
This is only correct for queries that don't have partition key restrictions.
To see this, modify line 289 in your test, in `executeSelectViaDriver()`...
```
return executeViaDriver(String.format("SELECT * from %s.%s WHERE k = 0 AND
v1 = 0", KEYSPACE, tableName));
```
The tests will still pass, even though they shouldn't. In other words, we
still test the guardrail even when we restrict the partition key. To fix this,
all I think we need to do is add a `restrictions.isKeyRange() &&` to the
beginning of our new `if` statement and add a test for that case.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]