psalagnac commented on code in PR #1871:
URL: https://github.com/apache/solr/pull/1871#discussion_r1315601759


##########
solr/core/src/java/org/apache/solr/handler/ContentStreamHandlerBase.java:
##########
@@ -101,6 +112,30 @@ public void handleRequestBody(SolrQueryRequest req, 
SolrQueryResponse rsp) throw
     }
   }
 
+  /**
+   * Check if UPDATE circuit breakers are tripped. Override this method in sub 
classes that do not
+   * want to check circuit breakers.
+   *
+   * @return true if circuit breakers are tripped, false otherwise.
+   */
+  protected boolean checkCircuitBreakers(SolrQueryRequest req, 
SolrQueryResponse rsp) {
+    CircuitBreakerRegistry circuitBreakerRegistry = 
req.getCore().getCircuitBreakerRegistry();
+    if (circuitBreakerRegistry.isEnabled(RequestType.UPDATE)) {
+      List<CircuitBreaker> trippedCircuitBreakers =
+          circuitBreakerRegistry.checkTripped(RequestType.UPDATE);
+      if (trippedCircuitBreakers != null) {
+        String errorMessage = 
CircuitBreakerRegistry.toErrorMessage(trippedCircuitBreakers);
+        rsp.add(STATUS, FAILURE);
+        rsp.setException(
+            new SolrException(
+                SolrException.ErrorCode.SERVICE_UNAVAILABLE,

Review Comment:
   Good point about compatibility of legacy `CircuitBreakerManager`. Thanks!



-- 
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: issues-unsubscr...@solr.apache.org

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


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

Reply via email to