[jira] [Commented] (CASSANDRA-17202) Avoid unnecessary String.format in QueryProcessor when getting stored prepared statement

2023-05-18 Thread Brandon Williams (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-17202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17723919#comment-17723919
 ] 

Brandon Williams commented on CASSANDRA-17202:
--

The one add 3.11 failure is actually my fault and fixed 
[here|https://github.com/apache/cassandra-dtest/commit/39c1c113e101b437ec66aaa8566e5c9c9e67b2ff].
  Everything else looks good to me, +1.

> Avoid unnecessary String.format in QueryProcessor when getting stored 
> prepared statement 
> -
>
> Key: CASSANDRA-17202
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17202
> Project: Cassandra
>  Issue Type: Bug
>  Components: Messaging/Client
>Reporter: Ivan Senic
>Assignee: Ivan Senic
>Priority: Low
> Fix For: 3.11.x, 4.0.x, 4.1.x, 5.x
>
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> In the _QueryProcessor#getStoredPreparedStatement_ if the statement is found 
> in the prepared statements cache, there is always unnecessary string creation 
> using String.format in order to execute the _checkTrue_ assertion. The string 
> construction is necessary only when the queries are not equal.
> {code:java}
> public static ResultMessage.Prepared getStoredPreparedStatement(String 
> queryString, String clientKeyspace)
> throws InvalidRequestException
> {
> MD5Digest statementId = computeId(queryString, clientKeyspace);
> Prepared existing = preparedStatements.getIfPresent(statementId);
> if (existing == null)
> 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));
>  {code}
> Hopefully the JIT can optimize this once the _checkTrue_ is inlined, but it's 
> getting on my nerves as it's popping up on my flame graphs all the time.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-17202) Avoid unnecessary String.format in QueryProcessor when getting stored prepared statement

2023-05-18 Thread Stefan Miklosovic (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-17202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17723838#comment-17723838
 ] 

Stefan Miklosovic commented on CASSANDRA-17202:
---

4.0 PR https://github.com/apache/cassandra/pull/2340
4.0 j8 
https://app.circleci.com/pipelines/github/instaclustr/cassandra/2232/workflows/49dbba70-2110-4039-ab8c-b6ad69a8f71e
4.0 j11 
https://app.circleci.com/pipelines/github/instaclustr/cassandra/2232/workflows/7d752769-ee9f-4859-b960-f3eaf4adfeb5

4.1 PR https://github.com/apache/cassandra/pull/2341
4.1 j8 
https://app.circleci.com/pipelines/github/instaclustr/cassandra/2231/workflows/c76bcc8e-a416-4edb-bd47-1689666e893f
4.1 j11 
https://app.circleci.com/pipelines/github/instaclustr/cassandra/2231/workflows/b0b21d1e-c9dc-4174-be37-09e6dee9dddc

> Avoid unnecessary String.format in QueryProcessor when getting stored 
> prepared statement 
> -
>
> Key: CASSANDRA-17202
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17202
> Project: Cassandra
>  Issue Type: Bug
>  Components: Messaging/Client
>Reporter: Ivan Senic
>Assignee: Ivan Senic
>Priority: Low
> Fix For: 3.11.x, 4.0.x, 4.1.x, 5.x
>
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> In the _QueryProcessor#getStoredPreparedStatement_ if the statement is found 
> in the prepared statements cache, there is always unnecessary string creation 
> using String.format in order to execute the _checkTrue_ assertion. The string 
> construction is necessary only when the queries are not equal.
> {code:java}
> public static ResultMessage.Prepared getStoredPreparedStatement(String 
> queryString, String clientKeyspace)
> throws InvalidRequestException
> {
> MD5Digest statementId = computeId(queryString, clientKeyspace);
> Prepared existing = preparedStatements.getIfPresent(statementId);
> if (existing == null)
> 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));
>  {code}
> Hopefully the JIT can optimize this once the _checkTrue_ is inlined, but it's 
> getting on my nerves as it's popping up on my flame graphs all the time.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-17202) Avoid unnecessary String.format in QueryProcessor when getting stored prepared statement

2023-05-15 Thread Stefan Miklosovic (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-17202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17722906#comment-17722906
 ] 

Stefan Miklosovic commented on CASSANDRA-17202:
---

Ah right, I saw 5.x so I went with trunk only. I will prepare the branches, 
sure.

> Avoid unnecessary String.format in QueryProcessor when getting stored 
> prepared statement 
> -
>
> Key: CASSANDRA-17202
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17202
> Project: Cassandra
>  Issue Type: Bug
>  Components: Messaging/Client
>Reporter: Ivan Senic
>Assignee: Ivan Senic
>Priority: Low
> Fix For: 3.11.x, 4.0.x, 4.1.x, 5.x
>
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> In the _QueryProcessor#getStoredPreparedStatement_ if the statement is found 
> in the prepared statements cache, there is always unnecessary string creation 
> using String.format in order to execute the _checkTrue_ assertion. The string 
> construction is necessary only when the queries are not equal.
> {code:java}
> public static ResultMessage.Prepared getStoredPreparedStatement(String 
> queryString, String clientKeyspace)
> throws InvalidRequestException
> {
> MD5Digest statementId = computeId(queryString, clientKeyspace);
> Prepared existing = preparedStatements.getIfPresent(statementId);
> if (existing == null)
> 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));
>  {code}
> Hopefully the JIT can optimize this once the _checkTrue_ is inlined, but it's 
> getting on my nerves as it's popping up on my flame graphs all the time.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-17202) Avoid unnecessary String.format in QueryProcessor when getting stored prepared statement

2023-05-15 Thread Brandon Williams (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-17202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17722903#comment-17722903
 ] 

Brandon Williams commented on CASSANDRA-17202:
--

We need a branch for 4.1, and CI for everything earlier than trunk.  I can help 
with the latter when the 4.1 branch is ready.

> Avoid unnecessary String.format in QueryProcessor when getting stored 
> prepared statement 
> -
>
> Key: CASSANDRA-17202
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17202
> Project: Cassandra
>  Issue Type: Bug
>  Components: Messaging/Client
>Reporter: Ivan Senic
>Assignee: Ivan Senic
>Priority: Low
> Fix For: 5.x
>
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> In the _QueryProcessor#getStoredPreparedStatement_ if the statement is found 
> in the prepared statements cache, there is always unnecessary string creation 
> using String.format in order to execute the _checkTrue_ assertion. The string 
> construction is necessary only when the queries are not equal.
> {code:java}
> public static ResultMessage.Prepared getStoredPreparedStatement(String 
> queryString, String clientKeyspace)
> throws InvalidRequestException
> {
> MD5Digest statementId = computeId(queryString, clientKeyspace);
> Prepared existing = preparedStatements.getIfPresent(statementId);
> if (existing == null)
> 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));
>  {code}
> Hopefully the JIT can optimize this once the _checkTrue_ is inlined, but it's 
> getting on my nerves as it's popping up on my flame graphs all the time.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-17202) Avoid unnecessary String.format in QueryProcessor when getting stored prepared statement

2023-05-15 Thread Stefan Miklosovic (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-17202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17722895#comment-17722895
 ] 

Stefan Miklosovic commented on CASSANDRA-17202:
---

rebased patch for trunk: https://github.com/apache/cassandra/pull/2335
j8: 
https://app.circleci.com/pipelines/github/instaclustr/cassandra/2201/workflows/d31afba8-8b29-43aa-86f2-ce88cd5b1ec7
j11: 
https://app.circleci.com/pipelines/github/instaclustr/cassandra/2201/workflows/a8c6ecb0-f798-4c61-8a38-8cf4c9a8ebe9

+1

> Avoid unnecessary String.format in QueryProcessor when getting stored 
> prepared statement 
> -
>
> Key: CASSANDRA-17202
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17202
> Project: Cassandra
>  Issue Type: Bug
>  Components: Messaging/Client
>Reporter: Ivan Senic
>Assignee: Ivan Senic
>Priority: Low
> Fix For: 5.x
>
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> In the _QueryProcessor#getStoredPreparedStatement_ if the statement is found 
> in the prepared statements cache, there is always unnecessary string creation 
> using String.format in order to execute the _checkTrue_ assertion. The string 
> construction is necessary only when the queries are not equal.
> {code:java}
> public static ResultMessage.Prepared getStoredPreparedStatement(String 
> queryString, String clientKeyspace)
> throws InvalidRequestException
> {
> MD5Digest statementId = computeId(queryString, clientKeyspace);
> Prepared existing = preparedStatements.getIfPresent(statementId);
> if (existing == null)
> 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));
>  {code}
> Hopefully the JIT can optimize this once the _checkTrue_ is inlined, but it's 
> getting on my nerves as it's popping up on my flame graphs all the time.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-17202) Avoid unnecessary String.format in QueryProcessor when getting stored prepared statement

2021-12-15 Thread Ivan Senic (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-17202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17460022#comment-17460022
 ] 

Ivan Senic commented on CASSANDRA-17202:


Done: 

3.11: [https://github.com/apache/cassandra/pull/1364]
4.0: [https://github.com/apache/cassandra/pull/1365]

 

> Avoid unnecessary String.format in QueryProcessor when getting stored 
> prepared statement 
> -
>
> Key: CASSANDRA-17202
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17202
> Project: Cassandra
>  Issue Type: Bug
>  Components: Messaging/Client
>Reporter: Ivan Senic
>Assignee: Ivan Senic
>Priority: Low
> Fix For: 4.x
>
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> In the _QueryProcessor#getStoredPreparedStatement_ if the statement is found 
> in the prepared statements cache, there is always unnecessary string creation 
> using String.format in order to execute the _checkTrue_ assertion. The string 
> construction is necessary only when the queries are not equal.
> {code:java}
> public static ResultMessage.Prepared getStoredPreparedStatement(String 
> queryString, String clientKeyspace)
> throws InvalidRequestException
> {
> MD5Digest statementId = computeId(queryString, clientKeyspace);
> Prepared existing = preparedStatements.getIfPresent(statementId);
> if (existing == null)
> 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));
>  {code}
> Hopefully the JIT can optimize this once the _checkTrue_ is inlined, but it's 
> getting on my nerves as it's popping up on my flame graphs all the time.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-17202) Avoid unnecessary String.format in QueryProcessor when getting stored prepared statement

2021-12-15 Thread Benjamin Lerer (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-17202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17459943#comment-17459943
 ] 

Benjamin Lerer commented on CASSANDRA-17202:


 [~ivansenic] Yes, if you do not mind. 

> Avoid unnecessary String.format in QueryProcessor when getting stored 
> prepared statement 
> -
>
> Key: CASSANDRA-17202
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17202
> Project: Cassandra
>  Issue Type: Bug
>  Components: Messaging/Client
>Reporter: Ivan Senic
>Assignee: Ivan Senic
>Priority: Low
> Fix For: 4.x
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> In the _QueryProcessor#getStoredPreparedStatement_ if the statement is found 
> in the prepared statements cache, there is always unnecessary string creation 
> using String.format in order to execute the _checkTrue_ assertion. The string 
> construction is necessary only when the queries are not equal.
> {code:java}
> public static ResultMessage.Prepared getStoredPreparedStatement(String 
> queryString, String clientKeyspace)
> throws InvalidRequestException
> {
> MD5Digest statementId = computeId(queryString, clientKeyspace);
> Prepared existing = preparedStatements.getIfPresent(statementId);
> if (existing == null)
> 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));
>  {code}
> Hopefully the JIT can optimize this once the _checkTrue_ is inlined, but it's 
> getting on my nerves as it's popping up on my flame graphs all the time.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-17202) Avoid unnecessary String.format in QueryProcessor when getting stored prepared statement

2021-12-15 Thread Ivan Senic (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-17202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17459937#comment-17459937
 ] 

Ivan Senic commented on CASSANDRA-17202:


The GitHub PR is updated as per request.

[~blerer] Are you saying I should create two more PRs, one targeting the 
_cassandra-3.11_ and one _cassandra-4.0_ branch? The current PR targets the 
{_}trunk{_}.

> Avoid unnecessary String.format in QueryProcessor when getting stored 
> prepared statement 
> -
>
> Key: CASSANDRA-17202
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17202
> Project: Cassandra
>  Issue Type: Bug
>  Components: Messaging/Client
>Reporter: Ivan Senic
>Assignee: Ivan Senic
>Priority: Low
> Fix For: 4.x
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> In the _QueryProcessor#getStoredPreparedStatement_ if the statement is found 
> in the prepared statements cache, there is always unnecessary string creation 
> using String.format in order to execute the _checkTrue_ assertion. The string 
> construction is necessary only when the queries are not equal.
> {code:java}
> public static ResultMessage.Prepared getStoredPreparedStatement(String 
> queryString, String clientKeyspace)
> throws InvalidRequestException
> {
> MD5Digest statementId = computeId(queryString, clientKeyspace);
> Prepared existing = preparedStatements.getIfPresent(statementId);
> if (existing == null)
> 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));
>  {code}
> Hopefully the JIT can optimize this once the _checkTrue_ is inlined, but it's 
> getting on my nerves as it's popping up on my flame graphs all the time.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-17202) Avoid unnecessary String.format in QueryProcessor when getting stored prepared statement

2021-12-15 Thread Benjamin Lerer (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-17202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17459856#comment-17459856
 ] 

Benjamin Lerer commented on CASSANDRA-17202:


In fact it seems that it also affect earlier releases. I think we also need a 
patch for 3.0 (it will merge cleanly into 3.11) and the patch for 4.0 (it will 
merge cleanly in trunk).
I you can make those patches. I will run CI for them :-) 

> Avoid unnecessary String.format in QueryProcessor when getting stored 
> prepared statement 
> -
>
> Key: CASSANDRA-17202
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17202
> Project: Cassandra
>  Issue Type: Bug
>  Components: Messaging/Client
>Reporter: Ivan Senic
>Assignee: Ivan Senic
>Priority: Low
> Fix For: 4.x
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> In the _QueryProcessor#getStoredPreparedStatement_ if the statement is found 
> in the prepared statements cache, there is always unnecessary string creation 
> using String.format in order to execute the _checkTrue_ assertion. The string 
> construction is necessary only when the queries are not equal.
> {code:java}
> public static ResultMessage.Prepared getStoredPreparedStatement(String 
> queryString, String clientKeyspace)
> throws InvalidRequestException
> {
> MD5Digest statementId = computeId(queryString, clientKeyspace);
> Prepared existing = preparedStatements.getIfPresent(statementId);
> if (existing == null)
> 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));
>  {code}
> Hopefully the JIT can optimize this once the _checkTrue_ is inlined, but it's 
> getting on my nerves as it's popping up on my flame graphs all the time.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-17202) Avoid unnecessary String.format in QueryProcessor when getting stored prepared statement

2021-12-14 Thread Benjamin Lerer (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-17202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17459379#comment-17459379
 ] 

Benjamin Lerer commented on CASSANDRA-17202:


Yes. Please. 

> Avoid unnecessary String.format in QueryProcessor when getting stored 
> prepared statement 
> -
>
> Key: CASSANDRA-17202
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17202
> Project: Cassandra
>  Issue Type: Bug
>  Components: Messaging/Client
>Reporter: Ivan Senic
>Assignee: Ivan Senic
>Priority: Low
> Fix For: 4.x
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> In the _QueryProcessor#getStoredPreparedStatement_ if the statement is found 
> in the prepared statements cache, there is always unnecessary string creation 
> using String.format in order to execute the _checkTrue_ assertion. The string 
> construction is necessary only when the queries are not equal.
> {code:java}
> public static ResultMessage.Prepared getStoredPreparedStatement(String 
> queryString, String clientKeyspace)
> throws InvalidRequestException
> {
> MD5Digest statementId = computeId(queryString, clientKeyspace);
> Prepared existing = preparedStatements.getIfPresent(statementId);
> if (existing == null)
> 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));
>  {code}
> Hopefully the JIT can optimize this once the _checkTrue_ is inlined, but it's 
> getting on my nerves as it's popping up on my flame graphs all the time.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-17202) Avoid unnecessary String.format in QueryProcessor when getting stored prepared statement

2021-12-13 Thread Ivan Senic (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-17202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17458466#comment-17458466
 ] 

Ivan Senic commented on CASSANDRA-17202:


[~blerer] I missed that.. Sure that's better and involves less changes.. Should 
I update the PR?

> Avoid unnecessary String.format in QueryProcessor when getting stored 
> prepared statement 
> -
>
> Key: CASSANDRA-17202
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17202
> Project: Cassandra
>  Issue Type: Bug
>  Components: Messaging/Client
>Reporter: Ivan Senic
>Assignee: Ivan Senic
>Priority: Low
> Fix For: 4.x
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> In the _QueryProcessor#getStoredPreparedStatement_ if the statement is found 
> in the prepared statements cache, there is always unnecessary string creation 
> using String.format in order to execute the _checkTrue_ assertion. The string 
> construction is necessary only when the queries are not equal.
> {code:java}
> public static ResultMessage.Prepared getStoredPreparedStatement(String 
> queryString, String clientKeyspace)
> throws InvalidRequestException
> {
> MD5Digest statementId = computeId(queryString, clientKeyspace);
> Prepared existing = preparedStatements.getIfPresent(statementId);
> if (existing == null)
> 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));
>  {code}
> Hopefully the JIT can optimize this once the _checkTrue_ is inlined, but it's 
> getting on my nerves as it's popping up on my flame graphs all the time.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-17202) Avoid unnecessary String.format in QueryProcessor when getting stored prepared statement

2021-12-13 Thread Benjamin Lerer (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-17202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17458403#comment-17458403
 ] 

Benjamin Lerer commented on CASSANDRA-17202:


{{checkTrue}} perform the {{String.format}} operation only after checking the 
value so removing the String.format is enough.

{code}
checkTrue(queryString.equals(existing.rawCQLStatement), "MD5 hash 
collision: query with the same MD5 hash was already prepared. \n Existing: 
'%s'", existing.rawCQLStatement);
{code} 

> Avoid unnecessary String.format in QueryProcessor when getting stored 
> prepared statement 
> -
>
> Key: CASSANDRA-17202
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17202
> Project: Cassandra
>  Issue Type: Bug
>  Components: Messaging/Client
>Reporter: Ivan Senic
>Assignee: Ivan Senic
>Priority: Low
> Fix For: 4.x
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> In the _QueryProcessor#getStoredPreparedStatement_ if the statement is found 
> in the prepared statements cache, there is always unnecessary string creation 
> using String.format in order to execute the _checkTrue_ assertion. The string 
> construction is necessary only when the queries are not equal.
> {code:java}
> public static ResultMessage.Prepared getStoredPreparedStatement(String 
> queryString, String clientKeyspace)
> throws InvalidRequestException
> {
> MD5Digest statementId = computeId(queryString, clientKeyspace);
> Prepared existing = preparedStatements.getIfPresent(statementId);
> if (existing == null)
> 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));
>  {code}
> Hopefully the JIT can optimize this once the _checkTrue_ is inlined, but it's 
> getting on my nerves as it's popping up on my flame graphs all the time.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-17202) Avoid unnecessary String.format in QueryProcessor when getting stored prepared statement

2021-12-10 Thread Brandon Williams (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-17202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17457263#comment-17457263
 ] 

Brandon Williams commented on CASSANDRA-17202:
--

Only known failures in CI, +1 from me.

> Avoid unnecessary String.format in QueryProcessor when getting stored 
> prepared statement 
> -
>
> Key: CASSANDRA-17202
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17202
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Messaging/Client
>Reporter: Ivan Senic
>Assignee: Ivan Senic
>Priority: Low
> Fix For: 4.x
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> In the _QueryProcessor#getStoredPreparedStatement_ if the statement is found 
> in the prepared statements cache, there is always unnecessary string creation 
> using String.format in order to execute the _checkTrue_ assertion. The string 
> construction is necessary only when the queries are not equal.
> {code:java}
> public static ResultMessage.Prepared getStoredPreparedStatement(String 
> queryString, String clientKeyspace)
> throws InvalidRequestException
> {
> MD5Digest statementId = computeId(queryString, clientKeyspace);
> Prepared existing = preparedStatements.getIfPresent(statementId);
> if (existing == null)
> 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));
>  {code}
> Hopefully the JIT can optimize this once the _checkTrue_ is inlined, but it's 
> getting on my nerves as it's popping up on my flame graphs all the time.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-17202) Avoid unnecessary String.format in QueryProcessor when getting stored prepared statement

2021-12-10 Thread Brandon Williams (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-17202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17457234#comment-17457234
 ] 

Brandon Williams commented on CASSANDRA-17202:
--

[Circle|https://app.circleci.com/pipelines/github/driftx/cassandra?branch=CASSANDRA-17202]
 running.

> Avoid unnecessary String.format in QueryProcessor when getting stored 
> prepared statement 
> -
>
> Key: CASSANDRA-17202
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17202
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Messaging/Client
>Reporter: Ivan Senic
>Assignee: Ivan Senic
>Priority: Low
> Fix For: 4.x
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> In the _QueryProcessor#getStoredPreparedStatement_ if the statement is found 
> in the prepared statements cache, there is always unnecessary string creation 
> using String.format in order to execute the _checkTrue_ assertion. The string 
> construction is necessary only when the queries are not equal.
> {code:java}
> public static ResultMessage.Prepared getStoredPreparedStatement(String 
> queryString, String clientKeyspace)
> throws InvalidRequestException
> {
> MD5Digest statementId = computeId(queryString, clientKeyspace);
> Prepared existing = preparedStatements.getIfPresent(statementId);
> if (existing == null)
> 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));
>  {code}
> Hopefully the JIT can optimize this once the _checkTrue_ is inlined, but it's 
> getting on my nerves as it's popping up on my flame graphs all the time.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-17202) Avoid unnecessary String.format in QueryProcessor when getting stored prepared statement

2021-12-10 Thread Ekaterina Dimitrova (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-17202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17457230#comment-17457230
 ] 

Ekaterina Dimitrova commented on CASSANDRA-17202:
-

Moving to Patch Available to trigger reviewers attention. Thank you

> Avoid unnecessary String.format in QueryProcessor when getting stored 
> prepared statement 
> -
>
> Key: CASSANDRA-17202
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17202
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Messaging/Client
>Reporter: Ivan Senic
>Assignee: Ivan Senic
>Priority: Low
> Fix For: 4.x
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> In the _QueryProcessor#getStoredPreparedStatement_ if the statement is found 
> in the prepared statements cache, there is always unnecessary string creation 
> using String.format in order to execute the _checkTrue_ assertion. The string 
> construction is necessary only when the queries are not equal.
> {code:java}
> public static ResultMessage.Prepared getStoredPreparedStatement(String 
> queryString, String clientKeyspace)
> throws InvalidRequestException
> {
> MD5Digest statementId = computeId(queryString, clientKeyspace);
> Prepared existing = preparedStatements.getIfPresent(statementId);
> if (existing == null)
> 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));
>  {code}
> Hopefully the JIT can optimize this once the _checkTrue_ is inlined, but it's 
> getting in my nerves as it's popping up on my flame graphs all the time.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-17202) Avoid unnecessary String.format in QueryProcessor when getting stored prepared statement

2021-12-10 Thread Ivan Senic (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-17202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17457170#comment-17457170
 ] 

Ivan Senic commented on CASSANDRA-17202:


PR: https://github.com/apache/cassandra/pull/1358

> Avoid unnecessary String.format in QueryProcessor when getting stored 
> prepared statement 
> -
>
> Key: CASSANDRA-17202
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17202
> Project: Cassandra
>  Issue Type: Improvement
>Reporter: Ivan Senic
>Assignee: Ivan Senic
>Priority: Normal
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> In the _QueryProcessor#getStoredPreparedStatement_ if the statement is found 
> in the prepared statements cache, there is always unnecessary string creation 
> using String.format in order to execute the _checkTrue_ assertion. The string 
> construction is necessary only when the queries are not equal.
> {code:java}
> public static ResultMessage.Prepared getStoredPreparedStatement(String 
> queryString, String clientKeyspace)
> throws InvalidRequestException
> {
> MD5Digest statementId = computeId(queryString, clientKeyspace);
> Prepared existing = preparedStatements.getIfPresent(statementId);
> if (existing == null)
> 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));
>  {code}
> Hopefully the JIT can optimize this once the _checkTrue_ is inlined, but it's 
> getting in my nerves as it's popping up on my flame graphs all the time.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org