You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by er...@apache.org on 2020/03/19 19:46:12 UTC
[lucene-solr] branch branch_8x updated: SOLR-12353:
SolrDispatchFilter expensive non-conditional debug line degrades
performance
This is an automated email from the ASF dual-hosted git repository.
erick pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/branch_8x by this push:
new 3387842 SOLR-12353: SolrDispatchFilter expensive non-conditional debug line degrades performance
3387842 is described below
commit 338784214525a3c92a5c9593d2db948c7b40d3b0
Author: Erick Erickson <Er...@gmail.com>
AuthorDate: Thu Mar 19 15:26:44 2020 -0400
SOLR-12353: SolrDispatchFilter expensive non-conditional debug line degrades performance
(cherry picked from commit 5fd55d77e9f5e3da620171e4348a9450c2ee3482)
---
solr/CHANGES.txt | 2 ++
.../org/apache/solr/servlet/SolrDispatchFilter.java | 20 ++++++++++++--------
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index cf04b96..1bc380f 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -43,6 +43,8 @@ Other Changes
* SOLR-13944: Remove redundant checks in SpellCheckCollator and add tests for spellcheck with collapse
(Stefan, Munendra S N, Tomas Eduardo Fernandez Lobbe)
+* SOLR-12353: SolrDispatchFilter expensive non-conditional debug line degrades performance (Pascal Proulx via Erick Erickson)
+
================== 8.5.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
diff --git a/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java b/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
index d744484..0f5f8d2 100644
--- a/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
+++ b/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
@@ -146,7 +146,9 @@ public class SolrDispatchFilter extends BaseSolrFilter {
public void init(FilterConfig config) throws ServletException
{
SSLConfigurationsFactory.current().init();
- log.trace("SolrDispatchFilter.init(): {}", this.getClass().getClassLoader());
+ if (log.isTraceEnabled()) {
+ log.trace("SolrDispatchFilter.init(): {}", this.getClass().getClassLoader());
+ }
CoreContainer coresInit = null;
try{
@@ -161,7 +163,7 @@ public class SolrDispatchFilter extends BaseSolrFilter {
}
String logLevel = System.getProperty(SOLR_LOG_LEVEL);
if (logLevel != null) {
- log.info("Log level override, property solr.log.level=" + logLevel);
+ log.info("Log level override, property solr.log.level={}", logLevel);
StartupLoggingUtils.changeLogLevel(logLevel);
}
@@ -184,7 +186,9 @@ public class SolrDispatchFilter extends BaseSolrFilter {
SolrPaths.ensureUserFilesDataDir(solrHomePath);
this.httpClient = coresInit.getUpdateShardHandler().getDefaultHttpClient();
setupJvmMetrics(coresInit);
- log.debug("user.dir=" + System.getProperty("user.dir"));
+ if (log.isDebugEnabled()) {
+ log.debug("user.dir={}", System.getProperty("user.dir"));
+ }
}
catch( Throwable t ) {
// catch this so our filter still works
@@ -485,21 +489,21 @@ public class SolrDispatchFilter extends BaseSolrFilter {
// /admin/info/key must be always open. see SOLR-9188
String requestPath = ServletUtils.getPathAfterContext(request);
if (PublicKeyHandler.PATH.equals(requestPath)) {
- if (log.isDebugEnabled())
- log.debug("Pass through PKI authentication endpoint");
+ log.debug("Pass through PKI authentication endpoint");
return true;
}
// /solr/ (Admin UI) must be always open to allow displaying Admin UI with login page
if ("/solr/".equals(requestPath) || "/".equals(requestPath)) {
- if (log.isDebugEnabled())
- log.debug("Pass through Admin UI entry point");
+ log.debug("Pass through Admin UI entry point");
return true;
}
String header = request.getHeader(PKIAuthenticationPlugin.HEADER);
if (header != null && cores.getPkiAuthenticationPlugin() != null)
authenticationPlugin = cores.getPkiAuthenticationPlugin();
try {
- log.debug("Request to authenticate: {}, domain: {}, port: {}", request, request.getLocalName(), request.getLocalPort());
+ if (log.isDebugEnabled()) {
+ log.debug("Request to authenticate: {}, domain: {}, port: {}", request, request.getLocalName(), request.getLocalPort());
+ }
// upon successful authentication, this should call the chain's next filter.
requestContinues = authenticationPlugin.authenticate(request, response, (req, rsp) -> {
isAuthenticated.set(true);