Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ protected SolrCore getCoreByCollection(String collectionName, boolean isPreferLe
SolrCore core = super.getCoreByCollection(collectionName, isPreferLeader);
if (core != null) return core;
if (!path.endsWith("/select")) return null;
return CoordinatorHttpSolrCall.getCore(factory, this, collectionName, isPreferLeader);
return CoordinatorHttpSolrCall.getCore(factory, this, collectionName);
}

@Override
protected void init() throws Exception {
super.init();
if (action == SolrDispatchFilter.Action.PROCESS && core != null) {
solrReq = CoordinatorHttpSolrCall.wrappedReq(solrReq, collectionName, this);
solrReq = CoordinatorHttpSolrCall.wrappedReq(solrReq, this);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ public void prepDistributed(ResponseBuilder rb) {
String shards = params.get(ShardParams.SHARDS);

CoreDescriptor coreDescriptor = req.getCore().getCoreDescriptor();
CloudDescriptor cloudDescriptor = req.getCloudDescriptor();
CloudDescriptor cloudDescriptor = coreDescriptor.getCloudDescriptor();
ZkController zkController = req.getCoreContainer().getZkController();

final ReplicaListTransformer replicaListTransformer =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.security.Principal;
import java.util.List;
import java.util.Map;
import org.apache.solr.cloud.CloudDescriptor;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.CommandOperation;
import org.apache.solr.common.util.ContentStream;
Expand Down Expand Up @@ -158,9 +157,4 @@ public Span getSpan() {
public CoreContainer getCoreContainer() {
return delegate.getCoreContainer();
}

@Override
public CloudDescriptor getCloudDescriptor() {
return delegate.getCloudDescriptor();
}
}
16 changes: 1 addition & 15 deletions solr/core/src/java/org/apache/solr/request/SolrQueryRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.util.List;
import java.util.Map;
import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.cloud.CloudDescriptor;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.CommandOperation;
Expand Down Expand Up @@ -188,20 +187,7 @@ default CoreContainer getCoreContainer() {
return core == null ? null : core.getCoreContainer();
}

/**
* @deprecated use getCore().getCoreDescriptor().getCloudDescriptor()
*/
@Deprecated
default CloudDescriptor getCloudDescriptor() {
return getCore().getCoreDescriptor().getCloudDescriptor();
}

/**
* The writer to use for this request, considering {@link CommonParams#WT}. Never null.
*
* <p>If a core is available, uses the core's response writer registry. If no core is available
* (e.g., for node/container requests), uses a minimal set of node/container-appropriate writers.
*/
/** The writer to use for this request, considering {@link CommonParams#WT}. Never null. */
default QueryResponseWriter getResponseWriter() {
// it's weird this method is here instead of SolrQueryResponse, but it's practical/convenient
SolrCore core = getCore();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,13 @@
import jakarta.servlet.http.HttpServletResponse;
import java.lang.invoke.MethodHandles;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.solr.api.CoordinatorV2HttpSolrCall;
import org.apache.solr.cloud.CloudDescriptor;
import org.apache.solr.cloud.api.collections.Assign;
import org.apache.solr.common.cloud.ClusterState;
import org.apache.solr.common.cloud.DocCollection;
import org.apache.solr.common.cloud.Replica;
import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.core.CoreDescriptor;
import org.apache.solr.core.SolrCore;
import org.apache.solr.core.SyntheticSolrCore;
import org.apache.solr.logging.MDCLoggingContext;
Expand Down Expand Up @@ -73,11 +69,10 @@ protected SolrCore getCoreByCollection(String collectionName, boolean isPreferLe
SolrCore core = super.getCoreByCollection(collectionName, isPreferLeader);
if (core != null) return core;
if (!path.endsWith("/select")) return null;
return getCore(factory, this, collectionName, isPreferLeader);
return getCore(factory, this, collectionName);
}

public static SolrCore getCore(
Factory factory, HttpSolrCall solrCall, String collectionName, boolean isPreferLeader) {
public static SolrCore getCore(Factory factory, HttpSolrCall solrCall, String collectionName) {
String syntheticCoreName = factory.collectionVsCoreNameMapping.get(collectionName);
if (syntheticCoreName != null) {
SolrCore syntheticCore = solrCall.cores.getCore(syntheticCoreName);
Expand Down Expand Up @@ -151,7 +146,7 @@ public static String getSyntheticCoreNameFromConfig(String configName) {
protected void init() throws Exception {
super.init();
if (action == SolrDispatchFilter.Action.PROCESS && core != null) {
solrReq = wrappedReq(solrReq, collectionName, this);
solrReq = wrappedReq(solrReq, this);
}
}

Expand All @@ -160,28 +155,12 @@ protected String getCoreOrColName() {
return collectionName;
}

public static SolrQueryRequest wrappedReq(
SolrQueryRequest delegate, String collectionName, HttpSolrCall httpSolrCall) {
Properties p = new Properties();
if (collectionName != null) {
p.put(CoreDescriptor.CORE_COLLECTION, collectionName);
}
p.put(CloudDescriptor.REPLICA_TYPE, Replica.Type.PULL.toString());
p.put(CoreDescriptor.CORE_SHARD, "_");

CloudDescriptor cloudDescriptor =
new CloudDescriptor(
delegate.getCore().getCoreDescriptor(), delegate.getCore().getName(), p);
public static SolrQueryRequest wrappedReq(SolrQueryRequest delegate, HttpSolrCall httpSolrCall) {
return new DelegatingSolrQueryRequest(delegate) {
@Override
public HttpSolrCall getHttpSolrCall() {
return httpSolrCall;
}

@Override
public CloudDescriptor getCloudDescriptor() {
return cloudDescriptor;
}
};
}

Expand Down