Avoid computing prepared statement size for unprepared batches

patch by Caleb Rackliffe; reviewed by Berenguer Blasi and Marcus Eriksson for CASSANDRA-20556
This commit is contained in:
Caleb Rackliffe 2025-04-15 10:11:45 -05:00
parent fcea0b6fd8
commit 78290bed45
3 changed files with 11 additions and 2 deletions

View File

@ -1,4 +1,5 @@
4.0.18
* Avoid computing prepared statement size for unprepared batches (CASSANDRA-20556)
* Fix Dropwizard Meter causes timeouts when infrequently used (CASSANDRA-19332)
* Update OWASP dependency checker to version 12.1.0 (CASSANDRA-20501)
* Suppress CVE-2025-25193 (CASSANDRA-20504)

View File

@ -392,6 +392,11 @@ public class QueryProcessor implements QueryHandler
}
public static Prepared parseAndPrepare(String query, ClientState clientState, boolean isInternal) throws RequestValidationException
{
return parseAndPrepare(query, clientState, isInternal, true);
}
public static Prepared parseAndPrepare(String query, ClientState clientState, boolean isInternal, boolean measure) throws RequestValidationException
{
CQLStatement.Raw raw = parseStatement(query);
@ -416,7 +421,10 @@ public class QueryProcessor implements QueryHandler
res = new Prepared(statement, "", fullyQualified, keyspace);
else
res = new Prepared(statement, query, fullyQualified, keyspace);
res.pstmntSize = measurePstmnt(res);
// Some prepared statements will not be cached and therefore do not require a pre-computed size.
if (measure)
res.pstmntSize = measurePstmnt(res);
return res;
}

View File

@ -184,7 +184,7 @@ public class BatchMessage extends Message.Request
{
p = QueryProcessor.parseAndPrepare((String) query,
state.getClientState().cloneWithKeyspaceIfSet(options.getKeyspace()),
false);
false, false);
}
else
{