Skip to content
Merged
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
3 changes: 3 additions & 0 deletions solr/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ Improvements

* SOLR-16438: Support optional split.setPreferredLeaders prop in shard split command. (Bruno Roustant)

* SOLR-10463: Introduce Builder setter for retryExpiryTime on cloud SolrClients. Deprecated
direct setter setRetryExpiryTime on cloud SolrClients. (Eric Pugh)

Optimizations
---------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import org.apache.solr.client.solrj.ResponseParser;
import org.apache.solr.client.solrj.request.RequestWriter;
import org.apache.solr.client.solrj.request.UpdateRequest;
Expand Down Expand Up @@ -64,6 +65,7 @@ protected CloudHttp2SolrClient(Builder builder) {
this.clientIsInternal = false;
this.myClient = builder.httpClient;
}
this.retryExpiryTime = builder.retryExpiryTime;
if (builder.requestWriter != null) {
this.myClient.requestWriter = builder.requestWriter;
}
Expand Down Expand Up @@ -143,6 +145,8 @@ public static class Builder {
protected Http2SolrClient.Builder internalClientBuilder;
private RequestWriter requestWriter;
private ResponseParser responseParser;
private long retryExpiryTime =
TimeUnit.NANOSECONDS.convert(3, TimeUnit.SECONDS); // 3 seconds or 3 million nanos

/**
* Provide a series of Solr URLs to be used when configuring {@link CloudHttp2SolrClient}
Expand Down Expand Up @@ -245,6 +249,14 @@ public Builder withParallelUpdates(boolean parallelUpdates) {
return this;
}

/**
* This is the time to wait to refetch the state after getting the same state version from ZK
*/
public Builder setRetryExpiryTime(int secs) {
this.retryExpiryTime = TimeUnit.NANOSECONDS.convert(secs, TimeUnit.SECONDS);
return this;
}

public Builder withHttpClient(Http2SolrClient httpClient) {
if (this.internalClientBuilder != null) {
throw new IllegalStateException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import org.apache.http.NoHttpResponseException;
import org.apache.http.client.HttpClient;
import org.apache.http.conn.ConnectTimeoutException;
Expand Down Expand Up @@ -85,6 +86,7 @@ protected CloudLegacySolrClient(Builder builder) {
} else {
this.stateProvider = builder.stateProvider;
}
this.retryExpiryTime = builder.retryExpiryTime;
this.clientIsInternal = builder.httpClient == null;
this.shutdownLBHttpSolrServer = builder.loadBalancedSolrClient == null;
if (builder.lbClientBuilder != null) {
Expand Down Expand Up @@ -194,6 +196,8 @@ public static class Builder extends SolrClientBuilder<Builder> {
protected boolean shardLeadersOnly = true;
protected boolean directUpdatesToLeadersOnly = false;
protected boolean parallelUpdates = true;
protected long retryExpiryTime =
TimeUnit.NANOSECONDS.convert(3, TimeUnit.SECONDS); // 3 seconds or 3 million nanos
protected ClusterStateProvider stateProvider;

/** Constructor for use by subclasses. This constructor was public prior to version 9.0 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public abstract class CloudSolrClient extends SolrClient {
new SolrNamedThreadFactory("CloudSolrClient ThreadPool"));

public static final String STATE_VERSION = "_stateVer_";
private long retryExpiryTime =
protected long retryExpiryTime =
TimeUnit.NANOSECONDS.convert(3, TimeUnit.SECONDS); // 3 seconds or 3 million nanos
private final Set<String> NON_ROUTABLE_PARAMS;

Expand Down Expand Up @@ -231,7 +231,10 @@ void evictStale() {
* This is the time to wait to refetch the state after getting the same state version from ZK
*
* <p>secs
*
* @deprecated use {@link CloudSolrClient.Builder#setRetryExpiryTime(int)} instead
*/
@Deprecated
public void setRetryExpiryTime(int secs) {
this.retryExpiryTime = TimeUnit.NANOSECONDS.convert(secs, TimeUnit.SECONDS);
}
Expand Down