janhoy commented on a change in pull request #78:
URL: https://github.com/apache/solr/pull/78#discussion_r614138208
##########
File path:
solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
##########
@@ -236,6 +240,21 @@ public void prepare(ResponseBuilder rb) throws IOException
if (rb.getSortSpec().getOffset() < 0) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "'start'
parameter cannot be negative");
}
+ if(rb.getSortSpec().getCount() > ROWS_WARN_THRESHOLD &&
shouldLogPeriodically("rowsWarn", 60)) {
+ log.warn("Very high 'rows' parameter detected. This may lead to
performance- and memory problems. " +
+ "Consider pagination, see
https://solr.apache.org/guide/pagination-of-results.html. " +
+ "This warning will mute for 60s.");
+ }
+ }
+
+ // Decides whether to log again based on key and interval
+ private static boolean shouldLogPeriodically(String key, int
intervalSeconds) {
Review comment:
I know this is a bit of an overkill for just one use. Are you aware of
similar logic elsewhere that we could use instead? Or some Util class where
this static method could live?
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]