Skip to content

Commit

Permalink
SOLR-15960: Remove explicit var conversion of global circuit breaker …
Browse files Browse the repository at this point in the history
…vars such as SOLR_CIRCUITBREAKER_UPDATE_CPU
  • Loading branch information
janhoy committed Dec 9, 2023
1 parent 2c74052 commit 28400bb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 22 deletions.
20 changes: 0 additions & 20 deletions solr/bin/solr
Original file line number Diff line number Diff line change
Expand Up @@ -1414,26 +1414,6 @@ if [ "${SOLR_ENABLE_STREAM_BODY:-false}" == "true" ]; then
SCRIPT_SOLR_OPTS+=("-Dsolr.enableStreamBody=true")
fi

# Parse global circuit breaker env vars and convert to dot separated, lowercase properties
if [ -n "${SOLR_CIRCUITBREAKER_UPDATE_CPU:-}" ]; then
SOLR_OPTS+=("-Dsolr.circuitbreaker.update.cpu=$SOLR_CIRCUITBREAKER_UPDATE_CPU")
fi
if [ -n "${SOLR_CIRCUITBREAKER_UPDATE_MEM:-}" ]; then
SOLR_OPTS+=("-Dsolr.circuitbreaker.update.mem=$SOLR_CIRCUITBREAKER_UPDATE_MEM")
fi
if [ -n "${SOLR_CIRCUITBREAKER_UPDATE_LOADAVG:-}" ]; then
SOLR_OPTS+=("-Dsolr.circuitbreaker.update.loadavg=$SOLR_CIRCUITBREAKER_UPDATE_LOADAVG")
fi
if [ -n "${SOLR_CIRCUITBREAKER_QUERY_CPU:-}" ]; then
SOLR_OPTS+=("-Dsolr.circuitbreaker.query.cpu=$SOLR_CIRCUITBREAKER_QUERY_CPU")
fi
if [ -n "${SOLR_CIRCUITBREAKER_QUERY_MEM:-}" ]; then
SOLR_OPTS+=("-Dsolr.circuitbreaker.query.mem=$SOLR_CIRCUITBREAKER_QUERY_MEM")
fi
if [ -n "${SOLR_CIRCUITBREAKER_QUERY_LOADAVG:-}" ]; then
SOLR_OPTS+=("-Dsolr.circuitbreaker.query.loadavg=$SOLR_CIRCUITBREAKER_QUERY_LOADAVG")
fi

: ${SOLR_SERVER_DIR:=$DEFAULT_SERVER_DIR}

if [ ! -e "$SOLR_SERVER_DIR" ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.apache.solr.client.solrj.SolrRequest.SolrRequestType;
import org.apache.solr.common.SolrException;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.util.EnvUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -68,8 +69,8 @@ public CircuitBreakerRegistry(CoreContainer coreContainer) {
private static void initGlobal(CoreContainer coreContainer) {
// Read system properties to register global circuit breakers for update and query:
// Example: solr.circuitbreaker.update.cpu = 50
System.getProperties().keySet().stream()
.map(k -> SYSPROP_REGEX.matcher(k.toString()))
EnvUtils.getProps().keySet().stream()
.map(SYSPROP_REGEX::matcher)
.filter(Matcher::matches)
.collect(Collectors.groupingBy(m -> m.group(2) + ":" + System.getProperty(m.group(0))))
.forEach(
Expand Down

0 comments on commit 28400bb

Please sign in to comment.