bereng commented on code in PR #3605:
URL: https://github.com/apache/cassandra/pull/3605#discussion_r1818972464


##########
src/java/org/apache/cassandra/cql3/QueryProcessor.java:
##########
@@ -797,9 +801,17 @@ public static CQLStatement.Raw parseStatement(String 
queryStr) throws SyntaxExce
         }
     }
 
-    private static int measure(Object key, Prepared value)
+    private static int measurePstmnt(Prepared value)
     {
-        return Ints.checkedCast(ObjectSizes.measureDeep(key) + 
ObjectSizes.measureDeep(value));
+        return Ints.checkedCast(ObjectSizes.measureDeep(value));
+    }
+
+    private static int getSizeForCache(MD5Digest key, Prepared value)

Review Comment:
   sgtm



##########
src/java/org/apache/cassandra/cql3/QueryProcessor.java:
##########
@@ -674,14 +678,14 @@ public static ResultMessage.Prepared 
storePreparedStatement(String queryString,
     {
         // Concatenate the current keyspace so we don't mix prepared 
statements between keyspace (#5352).
         // (if the keyspace is null, queryString has to have a fully-qualified 
keyspace so it's fine.
-        long statementSize = ObjectSizes.measureDeep(prepared.statement);
+        MD5Digest statementId = computeId(queryString, keyspace);
         // don't execute the statement if it's bigger than the allowed 
threshold
-        if (statementSize > 
capacityToBytes(DatabaseDescriptor.getPreparedStatementsCacheSizeMB()))
+        if ((prepared.pstmntSize + statementId.size()) > 
capacityToBytes(DatabaseDescriptor.getPreparedStatementsCacheSizeMB()))

Review Comment:
   +1



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