maedhroz commented on code in PR #2961:
URL: https://github.com/apache/cassandra/pull/2961#discussion_r1414263077


##########
src/java/org/apache/cassandra/index/sai/plan/QueryController.java:
##########
@@ -210,6 +215,34 @@ public KeyRangeIterator.Builder 
getIndexQueryResults(Collection<Expression> expr
         return builder;
     }
 
+    private void maybeTriggerGuardrails(QueryViewBuilder.QueryView queryView)
+    {
+        if (!cfs.isLeveledCompaction())
+            return;
+
+        boolean nonPartitionRestricted = false;
+
+        for (Pair<Expression, Collection<SSTableIndex>> pair : queryView.view)
+        {
+            if (pair.left.getIndexTermType().columnMetadata().kind != 
ColumnMetadata.Kind.PARTITION_KEY)
+            {
+                nonPartitionRestricted = true;
+                break;
+            }
+        }
+
+        if (!nonPartitionRestricted)
+            return;
+
+        
Guardrails.maximumSaiSSTablesWithNonParitionRestrictedQuery.guard(queryView.referencedIndexes.size(),
+                                                                          
format("%s on columns %s", command.metadata().toString(),
+                                                                               
  queryView.view.stream()
+                                                                               
                .map(p -> 
p.left.getIndexTermType().columnMetadata().name.toString())
+                                                                               
                .collect(Collectors.joining(", "))),
+                                                                          
false,
+                                                                          
null); // ???? how to propagate ClientState here?

Review Comment:
   See `SortedTableWriter#guardParititonThreshold()`. It doesn't actually use 
the client state, but passes null there.



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

Reply via email to