Skip to content

Apache Lucene open-source search software

SOLR-10440: LBHttpSolrClient.doRequest is now always wrapped in a Mapped Diagnostic Context (MDC).

Christine Poerschke206021578e79
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 95edf899cde..9e70c2435c1 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -201,6 +201,9 @@ Other Changes
* SOLR-10394: Rename getSortWithinGroup to getWithinGroupSort in search.grouping.Command class.
(Judith Silverman, Christine Poerschke)
+* SOLR-10440: LBHttpSolrClient.doRequest is now always wrapped in a Mapped Diagnostic Context (MDC).
+ (Christine Poerschke)
+
================== 6.5.1 ==================
Bug Fixes
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrClient.java
index 3cb59cd061a..b0f1a505d0d 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrClient.java
@@ -404,9 +404,14 @@ public class LBHttpSolrClient extends SolrClient {
break;
}
- ex = doRequest(wrapper.client, req, rsp, isNonRetryable, true, wrapper.getKey());
- if (ex == null) {
- return rsp; // SUCCESS
+ try {
+ MDC.put("LBHttpSolrClient.url", wrapper.client.getBaseURL());
+ ex = doRequest(wrapper.client, req, rsp, isNonRetryable, true, wrapper.getKey());
+ if (ex == null) {
+ return rsp; // SUCCESS
+ }
+ } finally {
+ MDC.remove("LBHttpSolrClient.url");
}
}
}