Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOLR-17151 Check limits between calls to components in SearchHandler #2801

Merged
merged 6 commits into from
Nov 10, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import org.apache.solr.response.SolrQueryResponse;
import org.apache.solr.search.CpuAllowedLimit;
import org.apache.solr.search.QueryLimits;
import org.apache.solr.search.QueryLimitsExceededException;
import org.apache.solr.search.SyntaxError;
import org.apache.solr.security.PermissionNameProvider;
import org.apache.solr.update.processor.DistributedUpdateProcessor;
Expand Down Expand Up @@ -241,6 +242,8 @@ public void handleRequest(SolrQueryRequest req, SolrQueryResponse rsp) {
metrics.numTimeouts.mark();
rsp.setHttpCaching(false);
}
} catch (QueryLimitsExceededException e) {
rsp.setPartialResults(req);
} catch (Exception e) {
Exception normalized = normalizeReceivedException(req, e);
processErrorMetricsOnException(normalized, metrics);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -615,17 +615,23 @@ protected int groupedDistributedProcess(ResponseBuilder rb) {
}

protected int regularDistributedProcess(ResponseBuilder rb) {
if (rb.stage < ResponseBuilder.STAGE_PARSE_QUERY) return ResponseBuilder.STAGE_PARSE_QUERY;
if (rb.stage < ResponseBuilder.STAGE_PARSE_QUERY) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, I never liked these one-liners.

return ResponseBuilder.STAGE_PARSE_QUERY;
}
if (rb.stage == ResponseBuilder.STAGE_PARSE_QUERY) {
createDistributedStats(rb);
return ResponseBuilder.STAGE_EXECUTE_QUERY;
}
if (rb.stage < ResponseBuilder.STAGE_EXECUTE_QUERY) return ResponseBuilder.STAGE_EXECUTE_QUERY;
if (rb.stage < ResponseBuilder.STAGE_EXECUTE_QUERY) {
return ResponseBuilder.STAGE_EXECUTE_QUERY;
}
if (rb.stage == ResponseBuilder.STAGE_EXECUTE_QUERY) {
createMainQuery(rb);
return ResponseBuilder.STAGE_GET_FIELDS;
}
if (rb.stage < ResponseBuilder.STAGE_GET_FIELDS) return ResponseBuilder.STAGE_GET_FIELDS;
if (rb.stage < ResponseBuilder.STAGE_GET_FIELDS) {
return ResponseBuilder.STAGE_GET_FIELDS;
}
if (rb.stage == ResponseBuilder.STAGE_GET_FIELDS && !rb.onePassDistributedQuery) {
createRetrieveDocs(rb);
return ResponseBuilder.STAGE_DONE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ public ResponseBuilder(
* public static final String LOCAL_SHARD = "local"; public static final String DOC_QUERY = "dq";
* *
*/
public static int STAGE_START = 0;
public static final int STAGE_START = 0;

public static int STAGE_PARSE_QUERY = 1000;
public static int STAGE_TOP_GROUPS = 1500;
public static int STAGE_EXECUTE_QUERY = 2000;
public static int STAGE_GET_FIELDS = 3000;
public static int STAGE_DONE = Integer.MAX_VALUE;
public static final int STAGE_PARSE_QUERY = 1000;
public static final int STAGE_TOP_GROUPS = 1500;
public static final int STAGE_EXECUTE_QUERY = 2000;
public static final int STAGE_GET_FIELDS = 3000;
public static final int STAGE_DONE = Integer.MAX_VALUE;

public int stage; // What stage is this current request at?

Expand Down
Loading
Loading