Skip to content

Commit

Permalink
Remove unnecessary String.format invocation in QueryProcessor when ge…
Browse files Browse the repository at this point in the history
…tting a prepared statement from cache

patch by Ivan Senic; reviewed by Stefan Miklosovic and Brandon Williams for CASSANDRA-17202
  • Loading branch information
Ivan Senic authored and smiklosovic committed May 18, 2023
1 parent f5c42f4 commit 3ca94d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
@@ -1,4 +1,5 @@
3.11.16
* Remove unnecessary String.format invocation in QueryProcessor when getting a prepared statement from cache (CASSANDRA-17202)
Merged from 3.0:
* Validate the existence of a datacenter in nodetool rebuild (CASSANDRA-14319)
* Suppress CVE-2023-2251 (CASSANDRA-18497)
Expand Down
6 changes: 4 additions & 2 deletions src/java/org/apache/cassandra/cql3/QueryProcessor.java
Expand Up @@ -564,7 +564,8 @@ public static ResultMessage.Prepared getStoredPreparedStatement(String queryStri
return null;

checkTrue(queryString.equals(existing.rawCQLStatement),
String.format("MD5 hash collision: query with the same MD5 hash was already prepared. \n Existing: '%s'", existing.rawCQLStatement));
"MD5 hash collision: query with the same MD5 hash was already prepared. \n Existing: '%s'",
existing.rawCQLStatement);
return ResultMessage.Prepared.forThrift(thriftStatementId, existing.boundNames);
}
else
Expand All @@ -575,7 +576,8 @@ public static ResultMessage.Prepared getStoredPreparedStatement(String queryStri
return null;

checkTrue(queryString.equals(existing.rawCQLStatement),
String.format("MD5 hash collision: query with the same MD5 hash was already prepared. \n Existing: '%s'", existing.rawCQLStatement));
"MD5 hash collision: query with the same MD5 hash was already prepared. \n Existing: '%s'",
existing.rawCQLStatement);
return new ResultMessage.Prepared(statementId, existing);
}
}
Expand Down

0 comments on commit 3ca94d6

Please sign in to comment.