Merge branch 'cassandra-6.0' into trunk

* cassandra-6.0:
  Avoid allocation by getFunctions in SelectStatement.authorize
This commit is contained in:
Dmitry Konstantinov 2026-05-06 13:13:11 +01:00
commit 9394991853
2 changed files with 14 additions and 0 deletions

View File

@ -10,6 +10,7 @@ Merged from 5.0:
6.0-alpha2
* Avoid allocation by getFunctions in SelectStatement.authorize (CASSANDRA-21347)
* Avoid unit conversion in DatabaseDescriptor.getMaxValueSize() for every deserializing Cell (CASSANDRA-21295)
* Fix single token batch atomicity with Accord/non-Accord batches by using the batch log (CASSANDRA-20588)
* Avoid CompactionOptions parsing for every read by WithoutPurgeableTombstones (CASSANDRA-21294)

View File

@ -194,6 +194,8 @@ public class SelectStatement implements CQLStatement.SingleKeyspaceCqlStatement,
*/
private final ColumnComparator<List<ByteBuffer>> orderingComparator;
private final List<Function> functions;
public final StatementSource source;
// Used by forSelection below
@ -228,6 +230,7 @@ public class SelectStatement implements CQLStatement.SingleKeyspaceCqlStatement,
this.perPartitionLimit = perPartitionLimit;
this.source = source;
this.selectOptions = selectOptions;
this.functions = findAllFunctions();
}
@Override
@ -244,9 +247,19 @@ public class SelectStatement implements CQLStatement.SingleKeyspaceCqlStatement,
@Override
public Iterable<Function> getFunctions()
{
return functions;
}
private List<Function> findAllFunctions()
{
List<Function> functions = new ArrayList<>();
addFunctionsTo(functions);
if (functions.isEmpty())
{
functions = Collections.emptyList(); // to avoid a new Iterator object creation during each authorization
}
return functions;
}