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


##########
src/java/org/apache/cassandra/db/SystemKeyspace.java:
##########
@@ -1863,16 +1865,37 @@ public static void resetPreparedStatements()
     }
 
     public static int loadPreparedStatements(TriFunction<MD5Digest, String, 
String, Boolean> onLoaded)
+    {
+        return loadPreparedStatements(onLoaded,
+                                      
QueryProcessor.PRELOAD_PREPARED_STATEMENTS_FETCH_SIZE,
+                                      
QueryProcessor.PRELOAD_PREPARED_STATEMENTS_MAX);
+    }
+
+    public static int loadPreparedStatements(TriFunction<MD5Digest, String, 
String, Boolean> onLoaded, int pageSize, int max)
     {
         String query = String.format("SELECT prepared_id, logged_keyspace, 
query_string FROM %s.%s", SchemaConstants.SYSTEM_KEYSPACE_NAME, 
PREPARED_STATEMENTS);
-        UntypedResultSet resultSet = executeOnceInternal(query);
+        UntypedResultSet resultSet = executeOnceInternalWithPaging(query, 
pageSize);
         int counter = 0;
         for (UntypedResultSet.Row row : resultSet)
         {
             if 
(onLoaded.accept(MD5Digest.wrap(row.getByteArray("prepared_id")),
                                 row.getString("query_string"),
                                 row.has("logged_keyspace") ? 
row.getString("logged_keyspace") : null))
                 counter++;
+
+            if (counter >= max)

Review Comment:
   Here you could check cache size every page, not every record for perf 
reasons, dropping `max` which we wouldn't need anymore and would not adapt to 
the cache size which is user configurable..



-- 
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: pr-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to