This is an automated email from the ASF dual-hosted git repository.
noble pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new 1463249b324 Coordinator node does not have correct collection tagged
for TracingSpan (#1962)
1463249b324 is described below
commit 1463249b324ac182a37f7fc728ce3aa30341f9ef
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 185cf6cb54c..67d291b38f7 100644
--- a/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
+++ b/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
@@ -635,10 +635,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();
if (coreOrColName != null) {
span.setTag(Tags.DB_INSTANCE, coreOrColName);
}
@@ -658,6 +655,14 @@ public class HttpSolrCall {
span.setOperationName(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);
}