This is an automated email from the ASF dual-hosted git repository.

noble pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/main by this push:
     new 03f656f0a63 Coordinator node does not have correct collection tagged 
for TracingSpan (#1962)
03f656f0a63 is described below

commit 03f656f0a63c08b95acc020860c0710a5c29bb65
Author: Noble Paul <[email protected]>
AuthorDate: Mon Oct 2 14:46:43 2023 +1100

    Coordinator node does not have correct collection tagged for TracingSpan 
(#1962)
---
 .../org/apache/solr/servlet/CoordinatorHttpSolrCall.java   | 14 ++++++++++++++
 .../src/java/org/apache/solr/servlet/HttpSolrCall.java     | 13 +++++++++----
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git 
a/solr/core/src/java/org/apache/solr/servlet/CoordinatorHttpSolrCall.java 
b/solr/core/src/java/org/apache/solr/servlet/CoordinatorHttpSolrCall.java
index 82664b23623..aa4a0e2fd75 100644
--- a/solr/core/src/java/org/apache/solr/servlet/CoordinatorHttpSolrCall.java
+++ b/solr/core/src/java/org/apache/solr/servlet/CoordinatorHttpSolrCall.java
@@ -47,6 +47,15 @@ import org.apache.solr.response.SolrQueryResponse;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+/**
+ * A coordinator node can serve requests as if it hosts all collections in the 
cluster. it does so
+ * by hosting a synthetic replica for each configset used in the cluster.
+ *
+ * <p>This class is responsible for forwarding the requests to the right core 
when the node is
+ * acting as a Coordinator The responsibilities also involve creating a 
synthetic collection or
+ * replica if they do not exist. It also sets the right threadlocal variables 
which reflects the
+ * current collection being served.
+ */
 public class CoordinatorHttpSolrCall extends HttpSolrCall {
   public static final String SYNTHETIC_COLL_PREFIX =
       Assign.SYSTEM_COLL_PREFIX + "COORDINATOR-COLL-";
@@ -277,6 +286,11 @@ public class CoordinatorHttpSolrCall extends HttpSolrCall {
     }
   }
 
+  @Override
+  protected String getCoreOrColName() {
+    return collectionName;
+  }
+
   public static SolrQueryRequest wrappedReq(
       SolrQueryRequest delegate, String collectionName, HttpSolrCall 
httpSolrCall) {
     Properties p = new Properties();
diff --git a/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java 
b/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
index 9137f3ded4e..ce9b1f8e6be 100644
--- a/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
+++ b/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
@@ -637,10 +637,7 @@ public class HttpSolrCall {
   // called after init().
   protected void populateTracingSpan(Span span) {
     // Set db.instance
-    String coreOrColName = HttpSolrCall.this.origCorename;
-    if (coreOrColName == null && getCore() != null) {
-      coreOrColName = getCore().getName();
-    }
+    String coreOrColName = getCoreOrColName();
     TraceUtils.setDbInstance(span, coreOrColName);
 
     // Set operation name.
@@ -658,6 +655,14 @@ public class HttpSolrCall {
     span.updateName(verb + ":" + path);
   }
 
+  protected String getCoreOrColName() {
+    String coreOrColName = HttpSolrCall.this.origCorename;
+    if (coreOrColName == null && getCore() != null) {
+      coreOrColName = getCore().getName();
+    }
+    return coreOrColName;
+  }
+
   public boolean shouldAudit() {
     return shouldAudit(cores);
   }

Reply via email to