[ 
https://issues.apache.org/jira/browse/SOLR-17158?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17819319#comment-17819319
 ] 

Andrzej Bialecki commented on SOLR-17158:
-----------------------------------------

Adding some observations from reading the code in {{{}SolrIndexSearcher}} and 
{{HttpShardHandler}}.

It appears that currently when {{timeAllowed}} is reached it doesn’t cause 
termination of all other pending shard requests. I found this section in 
{{SolrIndexSearcher:284}}:

{{  try {}}
{{      super.search(query, collector);}}
{{    } catch (TimeLimitingCollector.TimeExceededException}}
{{        | ExitableDirectoryReader.ExitingReaderException}}
{{        | CancellableCollector.QueryCancelledException x) {}}
{{      log.warn("Query: [{}]; ", query, x);}}
{{      qr.setPartialResults(true);}}

In the case when it reaches {{timeAllowed}} limit (and our new {{QueryLimits}}, 
too) it simply sets {{partialResults=true}} and does NOT throw any exception, 
so all the layers above think that the result is a success.

I suspect the reason for this was that when {{timeAllowed}} was set we still 
wanted to retrieve partial results when the limit was hit, and throwing an 
exception here would prevent that.

OTOH, if we had a request param saying “discard everything when you reach a 
limit and cancel any ongoing requests” then we could throw an exception here, 
and {{ShardHandler}} would recognize this as an error and cancel all other 
shard requests that are still pending, so that replicas could avoid sending 
back their results that would be discarded anyway.

> Terminate distributed processing quickly when query limit is reached
> --------------------------------------------------------------------
>
>                 Key: SOLR-17158
>                 URL: https://issues.apache.org/jira/browse/SOLR-17158
>             Project: Solr
>          Issue Type: Sub-task
>          Components: Query Limits
>            Reporter: Andrzej Bialecki
>            Assignee: Gus Heck
>            Priority: Major
>
> Solr should make sure that when query limits are reached and partial results 
> are not needed (and not wanted) then both the processing in shards and in the 
> query coordinator should be terminated as quickly as possible, and Solr 
> should minimize wasted resources spent on eg. returning data from the 
> remaining shards, merging responses in the coordinator, or returning any data 
> back to the user.



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

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

Reply via email to