cpoerschke commented on code in PR #1930:
URL: https://github.com/apache/solr/pull/1930#discussion_r1329049406
##########
solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java:
##########
@@ -343,4 +343,16 @@ public Collection<Api> getApis() {
return Collections.singleton(
new ApiBag.ReqHandlerToApi(this, ApiBag.constructSpec(pluginInfo)));
}
+
+ /**
+ * Checks whether the given request is an internal request to a shard. We
rely on the fact that an
+ * internal search request to a shard contains the param "isShard", and an
internal update request
+ * to a shard contains the param "distrib.from".
+ *
+ * @return true if request is internal
+ */
+ public static boolean isInternalShardRequest(SolrQueryRequest req) {
+ return req.getParams().get("distrib.from") != null
+ || "true".equals(req.getParams().get("isShard"));
Review Comment:
```suggestion
|| "true".equals(req.getParams().get(ShardParams.IS_SHARD));
```
##########
solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java:
##########
@@ -343,4 +343,16 @@ public Collection<Api> getApis() {
return Collections.singleton(
new ApiBag.ReqHandlerToApi(this, ApiBag.constructSpec(pluginInfo)));
}
+
+ /**
+ * Checks whether the given request is an internal request to a shard. We
rely on the fact that an
+ * internal search request to a shard contains the param "isShard", and an
internal update request
+ * to a shard contains the param "distrib.from".
+ *
+ * @return true if request is internal
+ */
+ public static boolean isInternalShardRequest(SolrQueryRequest req) {
+ return req.getParams().get("distrib.from") != null
Review Comment:
```suggestion
return req.getParams().get(DistributedUpdateProcessor.DISTRIB_FROM) !=
null
```
##########
solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java:
##########
@@ -343,4 +343,16 @@ public Collection<Api> getApis() {
return Collections.singleton(
new ApiBag.ReqHandlerToApi(this, ApiBag.constructSpec(pluginInfo)));
}
+
+ /**
+ * Checks whether the given request is an internal request to a shard. We
rely on the fact that an
+ * internal search request to a shard contains the param "isShard", and an
internal update request
+ * to a shard contains the param "distrib.from".
+ *
+ * @return true if request is internal
+ */
+ public static boolean isInternalShardRequest(SolrQueryRequest req) {
Review Comment:
Perhaps this could even be protected and non-static i.e. by overriding
handlers could also treat other requests as-if they are internal and so exempt
them from circuit breaker logic? Hmm, though then `isInternalShardRequest`
could be confusing as a name.
```suggestion
protected boolean isInternalShardRequest(SolrQueryRequest req) {
```
--
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]