Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
@@ -0,0 +1,8 @@
# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc
title: Add CloudJettySolrClient. Rename Http2SolrClient to HttpJettySolrClient
type: other # added, changed, fixed, deprecated, removed, dependency_update, security, other
authors:
- name: David Smiley
links:
- name: SOLR-18005
url: https://issues.apache.org/jira/browse/SOLR-18005
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import java.util.concurrent.TimeUnit;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
import org.apache.solr.client.solrj.jetty.HttpJettySolrClient;
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
import org.apache.solr.client.solrj.request.QueryRequest;
import org.apache.solr.client.solrj.request.UpdateRequest;
Expand Down Expand Up @@ -82,7 +82,7 @@ public static class MiniClusterBenchState {
MiniSolrCloudCluster cluster;

/** The Client. */
public Http2SolrClient client;
public HttpJettySolrClient client;

/** The Run cnt. */
int runCnt = 0;
Expand Down Expand Up @@ -291,7 +291,7 @@ public void startMiniCluster(int nodeCount) {
}
zkHost = cluster.getZkServer().getZkAddress();

client = new Http2SolrClient.Builder(nodes.get(0)).useHttp1_1(useHttp1).build();
client = new HttpJettySolrClient.Builder(nodes.get(0)).useHttp1_1(useHttp1).build();

log("done starting mini cluster");
log("");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
import org.apache.solr.bench.MiniClusterState;
import org.apache.solr.bench.MiniClusterState.MiniClusterBenchState;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
import org.apache.solr.client.solrj.io.SolrClientCache;
import org.apache.solr.client.solrj.io.Tuple;
import org.apache.solr.client.solrj.io.stream.CloudSolrStream;
import org.apache.solr.client.solrj.io.stream.StreamContext;
import org.apache.solr.client.solrj.io.stream.TupleStream;
import org.apache.solr.client.solrj.jetty.HttpJettySolrClient;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.openjdk.jmh.annotations.Benchmark;
Expand Down Expand Up @@ -68,7 +68,7 @@ public static class BenchState {
private String zkHost;
private ModifiableSolrParams params;
private StreamContext streamContext;
private Http2SolrClient http2SolrClient;
private HttpJettySolrClient httpJettySolrClient;

@Setup(Level.Trial)
public void setup(MiniClusterBenchState miniClusterState) throws Exception {
Expand Down Expand Up @@ -98,7 +98,7 @@ public void setupIteration(MiniClusterState.MiniClusterBenchState miniClusterSta
throws SolrServerException, IOException {
SolrClientCache solrClientCache;
// TODO tune params?
var client = new Http2SolrClient.Builder().useHttp1_1(useHttp1).build();
var client = new HttpJettySolrClient.Builder().useHttp1_1(useHttp1).build();
solrClientCache = new SolrClientCache(client);

streamContext = new StreamContext();
Expand All @@ -108,8 +108,8 @@ public void setupIteration(MiniClusterState.MiniClusterBenchState miniClusterSta
@TearDown(Level.Iteration)
public void teardownIt() {
streamContext.getSolrClientCache().close();
if (http2SolrClient != null) {
http2SolrClient.close();
if (httpJettySolrClient != null) {
httpJettySolrClient.close();
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions solr/core/src/java/org/apache/solr/cli/CLIUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.CloudHttp2SolrClient;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
import org.apache.solr.client.solrj.impl.SolrZkClientTimeout;
import org.apache.solr.client.solrj.jetty.HttpJettySolrClient;
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
import org.apache.solr.client.solrj.request.CoresApi;
import org.apache.solr.client.solrj.request.GenericSolrRequest;
Expand Down Expand Up @@ -109,8 +109,8 @@ public static SolrClient getSolrClient(String solrUrl, String credentials, boole
if (!barePath && !solrUrl.endsWith("/solr") && !solrUrl.contains("/solr/")) {
solrUrl = solrUrl + "/solr";
}
Http2SolrClient.Builder builder =
new Http2SolrClient.Builder(solrUrl)
var builder =
new HttpJettySolrClient.Builder(solrUrl)
.withMaxConnectionsPerHost(32)
.withKeyStoreReloadInterval(-1, TimeUnit.SECONDS)
.withOptionalBasicAuthCredentials(credentials);
Expand Down Expand Up @@ -288,7 +288,7 @@ public static CloudHttp2SolrClient getCloudHttp2SolrClient(String zkHost) {
}

public static CloudHttp2SolrClient getCloudHttp2SolrClient(
String zkHost, Http2SolrClient.Builder builder) {
String zkHost, HttpJettySolrClient.Builder builder) {
return new CloudHttp2SolrClient.Builder(Collections.singletonList(zkHost), Optional.empty())
.withHttpClientBuilder(builder)
.build();
Expand Down
6 changes: 3 additions & 3 deletions solr/core/src/java/org/apache/solr/cli/CreateTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
import org.apache.solr.client.solrj.impl.JsonMapResponseParser;
import org.apache.solr.client.solrj.jetty.HttpJettySolrClient;
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
import org.apache.solr.client.solrj.request.CoreAdminRequest;
import org.apache.solr.client.solrj.request.GenericSolrRequest;
Expand Down Expand Up @@ -208,8 +208,8 @@ protected void createCore(CommandLine cli, SolrClient solrClient) throws Excepti
}

protected void createCollection(CommandLine cli) throws Exception {
Http2SolrClient.Builder builder =
new Http2SolrClient.Builder()
var builder =
new HttpJettySolrClient.Builder()
.withIdleTimeout(30, TimeUnit.SECONDS)
.withConnectionTimeout(15, TimeUnit.SECONDS)
.withKeyStoreReloadInterval(-1, TimeUnit.SECONDS)
Expand Down
6 changes: 3 additions & 3 deletions solr/core/src/java/org/apache/solr/cli/DeleteTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
import org.apache.solr.client.solrj.impl.JsonMapResponseParser;
import org.apache.solr.client.solrj.jetty.HttpJettySolrClient;
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
import org.apache.solr.client.solrj.request.CoreAdminRequest;
import org.apache.solr.common.cloud.ZkStateReader;
Expand Down Expand Up @@ -105,8 +105,8 @@ public void runImpl(CommandLine cli) throws Exception {
}

protected void deleteCollection(CommandLine cli) throws Exception {
Http2SolrClient.Builder builder =
new Http2SolrClient.Builder()
var builder =
new HttpJettySolrClient.Builder()
.withIdleTimeout(30, TimeUnit.SECONDS)
.withConnectionTimeout(15, TimeUnit.SECONDS)
.withKeyStoreReloadInterval(-1, TimeUnit.SECONDS)
Expand Down
5 changes: 2 additions & 3 deletions solr/core/src/java/org/apache/solr/cli/ExportTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
import org.apache.solr.client.solrj.impl.CloudHttp2SolrClient;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.client.solrj.impl.ClusterStateProvider;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
import org.apache.solr.client.solrj.impl.StreamingJavaBinResponseParser;
import org.apache.solr.client.solrj.jetty.HttpJettySolrClient;
import org.apache.solr.client.solrj.request.GenericSolrRequest;
import org.apache.solr.client.solrj.request.QueryRequest;
import org.apache.solr.common.SolrDocument;
Expand Down Expand Up @@ -252,8 +252,7 @@ DocsSink getSink() {
abstract void exportDocs() throws Exception;

void fetchUniqueKey() throws SolrServerException, IOException {
Http2SolrClient.Builder builder =
new Http2SolrClient.Builder().withOptionalBasicAuthCredentials(credentials);
var builder = new HttpJettySolrClient.Builder().withOptionalBasicAuthCredentials(credentials);

solrClient =
new CloudHttp2SolrClient.Builder(Collections.singletonList(baseurl))
Expand Down
6 changes: 3 additions & 3 deletions solr/core/src/java/org/apache/solr/cli/PostLogsTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
import org.apache.solr.client.solrj.jetty.HttpJettySolrClient;
import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.SolrInputField;
Expand Down Expand Up @@ -107,8 +107,8 @@ public void runCommand(String baseUrl, String root, String credentials) throws I
+ "] must point to a particular collection but appears to be a Solr base URL");
}

Http2SolrClient.Builder builder =
new Http2SolrClient.Builder(URLUtil.extractBaseUrl(baseUrl))
var builder =
new HttpJettySolrClient.Builder(URLUtil.extractBaseUrl(baseUrl))
.withDefaultCollection(URLUtil.extractCoreFromCoreUrl(baseUrl))
.withKeyStoreReloadInterval(-1, TimeUnit.SECONDS)
.withOptionalBasicAuthCredentials(credentials);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.apache.lucene.store.Directory;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
import org.apache.solr.client.solrj.jetty.HttpJettySolrClient;
import org.apache.solr.client.solrj.request.AbstractUpdateRequest;
import org.apache.solr.client.solrj.request.CoreAdminRequest.WaitForState;
import org.apache.solr.client.solrj.request.UpdateRequest;
Expand Down Expand Up @@ -177,9 +177,10 @@ public final void setRecoveringAfterStartup(boolean recoveringAfterStartup) {
this.recoveringAfterStartup = recoveringAfterStartup;
}

private Http2SolrClient.Builder recoverySolrClientBuilder(String baseUrl, String leaderCoreName) {
private HttpJettySolrClient.Builder recoverySolrClientBuilder(
String baseUrl, String leaderCoreName) {
final UpdateShardHandlerConfig cfg = cc.getConfig().getUpdateShardHandlerConfig();
return new Http2SolrClient.Builder(baseUrl)
return new HttpJettySolrClient.Builder(baseUrl)
.withDefaultCollection(leaderCoreName)
.withHttpClient(cc.getUpdateShardHandler().getRecoveryOnlyHttpClient());
}
Expand Down
6 changes: 3 additions & 3 deletions solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import java.util.concurrent.TimeUnit;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
import org.apache.solr.client.solrj.jetty.HttpJettySolrClient;
import org.apache.solr.client.solrj.request.CoreAdminRequest.RequestRecovery;
import org.apache.solr.common.cloud.ZkCoreNodeProps;
import org.apache.solr.common.cloud.ZkNodeProps;
Expand All @@ -53,7 +53,7 @@ public class SyncStrategy {

private volatile boolean isClosed;

private final Http2SolrClient solrClient;
private final HttpJettySolrClient solrClient;

private final ExecutorService updateExecutor;

Expand Down Expand Up @@ -358,7 +358,7 @@ private void requestRecovery(
recoverRequestCmd.setAction(CoreAdminAction.REQUESTRECOVERY);
recoverRequestCmd.setCoreName(coreName);
try (SolrClient client =
new Http2SolrClient.Builder(baseUrl)
new HttpJettySolrClient.Builder(baseUrl)
.withHttpClient(solrClient)
.withIdleTimeout(120000, TimeUnit.MILLISECONDS)
.build()) {
Expand Down
4 changes: 2 additions & 2 deletions solr/core/src/java/org/apache/solr/cloud/ZkController.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@
import org.apache.solr.client.solrj.cloud.SolrCloudManager;
import org.apache.solr.client.solrj.impl.CloudHttp2SolrClient;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
import org.apache.solr.client.solrj.impl.SolrClientCloudManager;
import org.apache.solr.client.solrj.impl.SolrZkClientTimeout;
import org.apache.solr.client.solrj.impl.ZkClientClusterStateProvider;
import org.apache.solr.client.solrj.jetty.HttpJettySolrClient;
import org.apache.solr.client.solrj.request.CoreAdminRequest.WaitForState;
import org.apache.solr.cloud.api.collections.DistributedCollectionConfigSetCommandRunner;
import org.apache.solr.cloud.overseer.ClusterStateMutator;
Expand Down Expand Up @@ -2320,7 +2320,7 @@ private ZkCoreNodeProps waitForLeaderToSeeDownState(
// TODO ideally want 8sec connection timeout but can't easily also share the client
// listeners
try (SolrClient client =
new Http2SolrClient.Builder(leaderBaseUrl)
new HttpJettySolrClient.Builder(leaderBaseUrl)
.withHttpClient(getCoreContainer().getDefaultHttpSolrClient())
.withIdleTimeout(30000, TimeUnit.MILLISECONDS)
.build()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrResponse;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
import org.apache.solr.client.solrj.jetty.HttpJettySolrClient;
import org.apache.solr.client.solrj.request.AbstractUpdateRequest;
import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.client.solrj.response.UpdateResponse;
Expand Down Expand Up @@ -219,7 +219,7 @@ static void checkResults(String label, NamedList<Object> results, boolean failur
}

static void commit(
Http2SolrClient solrClient,
HttpJettySolrClient solrClient,
NamedList<Object> results,
String slice,
Replica parentShardLeader) {
Expand All @@ -244,7 +244,7 @@ static void commit(
}

private static UpdateResponse softCommit(
Http2SolrClient solrClient, String baseUrl, String coreName)
HttpJettySolrClient solrClient, String baseUrl, String coreName)
throws SolrServerException, IOException {
UpdateRequest ureq = new UpdateRequest();
ureq.setAction(AbstractUpdateRequest.ACTION.COMMIT, false, true, true);
Expand Down
6 changes: 3 additions & 3 deletions solr/core/src/java/org/apache/solr/core/CoreContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@
import org.apache.solr.api.ContainerPluginsRegistry;
import org.apache.solr.api.JerseyResource;
import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
import org.apache.solr.client.solrj.impl.HttpSolrClientBase;
import org.apache.solr.client.solrj.io.SolrClientCache;
import org.apache.solr.client.solrj.jetty.HttpJettySolrClient;
import org.apache.solr.client.solrj.util.SolrIdentifierValidator;
import org.apache.solr.cloud.CloudDescriptor;
import org.apache.solr.cloud.ClusterSingleton;
Expand Down Expand Up @@ -2389,10 +2389,10 @@ public PlacementPluginFactory<? extends PlacementPluginConfig> getPlacementPlugi
*
* <p>The caller does not need to close the client.
*
* @return the existing {@link Http2SolrClient}
* @return the existing {@link HttpJettySolrClient}
* @see HttpSolrClientBase#requestWithBaseUrl(String, SolrRequest, String)
*/
public Http2SolrClient getDefaultHttpSolrClient() {
public HttpJettySolrClient getDefaultHttpSolrClient() {
return solrClientProvider.getSolrClient();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import io.opentelemetry.api.common.Attributes;
import java.util.concurrent.TimeUnit;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
import org.apache.solr.client.solrj.jetty.HttpJettySolrClient;
import org.apache.solr.common.util.IOUtils;
import org.apache.solr.metrics.SolrMetricsContext;
import org.apache.solr.security.HttpClientBuilderPlugin;
Expand All @@ -34,16 +34,16 @@ final class HttpSolrClientProvider implements AutoCloseable {

static final String METRIC_SCOPE_NAME = "defaultHttpSolrClientProvider";

private final Http2SolrClient httpSolrClient;
private final HttpJettySolrClient httpSolrClient;

private final InstrumentedHttpListenerFactory trackHttpSolrMetrics;

HttpSolrClientProvider(UpdateShardHandlerConfig cfg, SolrMetricsContext parentContext) {
trackHttpSolrMetrics = new InstrumentedHttpListenerFactory(getNameStrategy(cfg));
initializeMetrics(parentContext);

Http2SolrClient.Builder httpClientBuilder =
new Http2SolrClient.Builder().addListenerFactory(trackHttpSolrMetrics);
var httpClientBuilder =
new HttpJettySolrClient.Builder().addListenerFactory(trackHttpSolrMetrics);

if (cfg != null) {
httpClientBuilder
Expand All @@ -68,7 +68,7 @@ private void initializeMetrics(SolrMetricsContext parentContext) {
trackHttpSolrMetrics.initializeMetrics(solrMetricsContext, Attributes.empty());
}

Http2SolrClient getSolrClient() {
HttpJettySolrClient getSolrClient() {
return httpSolrClient;
}

Expand Down
8 changes: 4 additions & 4 deletions solr/core/src/java/org/apache/solr/handler/IndexFetcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@
import org.apache.solr.client.api.model.FileMetaData;
import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
import org.apache.solr.client.solrj.impl.InputStreamResponseParser;
import org.apache.solr.client.solrj.impl.SolrHttpConstants;
import org.apache.solr.client.solrj.jetty.HttpJettySolrClient;
import org.apache.solr.client.solrj.request.GenericSolrRequest;
import org.apache.solr.cloud.CloudDescriptor;
import org.apache.solr.cloud.ZkController;
Expand Down Expand Up @@ -179,7 +179,7 @@ public class IndexFetcher {

boolean fetchFromLeader = false;

private final Http2SolrClient solrClient;
private final HttpJettySolrClient solrClient;

private Integer soTimeout;

Expand Down Expand Up @@ -251,10 +251,10 @@ public String getMessage() {
// It's crucial not to remove the authentication credentials as they are essential for User
// managed replication.
// GitHub PR #2276
private Http2SolrClient createSolrClient(
private HttpJettySolrClient createSolrClient(
SolrCore core, String httpBasicAuthUser, String httpBasicAuthPassword, String leaderBaseUrl) {
final UpdateShardHandler updateShardHandler = core.getCoreContainer().getUpdateShardHandler();
return new Http2SolrClient.Builder(leaderBaseUrl)
return new HttpJettySolrClient.Builder(leaderBaseUrl)
.withHttpClient(updateShardHandler.getRecoveryOnlyHttpClient())
.withBasicAuthCredentials(httpBasicAuthUser, httpBasicAuthPassword)
.withIdleTimeout(soTimeout, TimeUnit.MILLISECONDS)
Expand Down
Loading
Loading