This is an automated email from the ASF dual-hosted git repository.
epugh 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 ac578775e39 SOLR-10470: setParallelCacheRefreshes should be deprecated
in favor of SolrClientBuilder methods (#1248)
ac578775e39 is described below
commit ac578775e39dc0fc4abd89a1bc1bfe9424533e3c
Author: Eric Pugh <[email protected]>
AuthorDate: Sat Dec 31 17:11:47 2022 -0500
SOLR-10470: setParallelCacheRefreshes should be deprecated in favor of
SolrClientBuilder methods (#1248)
Introduce Builder setter for parallelCacheRefreshes on cloud SolrClients.
Deprecated direct setter setParallelCacheRefreshes on cloud SolrClients.
Inlined logic for creating object locks.
---
solr/CHANGES.txt | 5 ++++-
.../solr/client/solrj/impl/CloudHttp2SolrClient.java | 16 ++++++++++++++++
.../apache/solr/client/solrj/impl/CloudSolrClient.java | 5 ++++-
3 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 63101604f2d..5e3589aee38 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -98,11 +98,14 @@ Improvements
* SOLR-10462: Introduce Builder setter for pollQueueTime on
ConcurrentUpdateHttp2SolrClient. Deprecated
direct setter setPollQueueTime on ConcurrentUpdateHttp2SolrClient. (Eric
Pugh)
-
+
* SOLR-10452: Introduce Builder setter withTheseParamNamesInTheUrl for
queryParams, renaming them to urlParamNames
to clarify they are parameter names, not the values. Deprecated direct
setter setQueryParams and addQueryParams
on SolrClients. (Eric Pugh, David Smiley, Alex Deparvu)
+* SOLR-10470: Introduce Builder setter for parallelCacheRefreshes on cloud
SolrClients. Deprecated
+ direct setter setParallelCacheRefreshes on cloud SolrClients. (Eric Pugh,
David Smiley, Alex Deparvu)
+
Optimizations
---------------------
diff --git
a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudHttp2SolrClient.java
b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudHttp2SolrClient.java
index 4692eede98c..04eb2f7f0d6 100644
---
a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudHttp2SolrClient.java
+++
b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudHttp2SolrClient.java
@@ -98,6 +98,10 @@ public class CloudHttp2SolrClient extends CloudSolrClient {
this.stateProvider = builder.stateProvider;
}
+ // If caches are expired then they are refreshed after acquiring a lock.
Set the number of
+ // locks.
+ this.locks = objectList(builder.parallelCacheRefreshesLocks);
+
this.lbClient = new LBHttp2SolrClient.Builder(myClient).build();
}
@@ -147,6 +151,7 @@ public class CloudHttp2SolrClient extends CloudSolrClient {
private ResponseParser responseParser;
private long retryExpiryTime =
TimeUnit.NANOSECONDS.convert(3, TimeUnit.SECONDS); // 3 seconds or 3
million nanos
+ private int parallelCacheRefreshesLocks = 3;
/**
* Provide a series of Solr URLs to be used when configuring {@link
CloudHttp2SolrClient}
@@ -249,6 +254,17 @@ public class CloudHttp2SolrClient extends CloudSolrClient {
return this;
}
+ /**
+ * When caches are expired then they are refreshed after acquiring a lock.
Use this to set the
+ * number of locks.
+ *
+ * <p>Defaults to 3.
+ */
+ public Builder setParallelCacheRefreshes(int parallelCacheRefreshesLocks) {
+ this.parallelCacheRefreshesLocks = parallelCacheRefreshesLocks;
+ return this;
+ }
+
/**
* This is the time to wait to refetch the state after getting the same
state version from ZK
*/
diff --git
a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java
b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java
index ea997a62158..ccc328ff23b 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java
@@ -126,7 +126,7 @@ public abstract class CloudSolrClient extends SolrClient {
}
- private volatile List<Object> locks = objectList(3);
+ protected volatile List<Object> locks = objectList(3);
/** Constructs {@link CloudSolrClient} instances from provided
configuration. */
public static class Builder extends CloudHttp2SolrClient.Builder {
@@ -1222,7 +1222,10 @@ public abstract class CloudSolrClient extends SolrClient
{
/**
* If caches are expired they are refreshed after acquiring a lock. use this
to set the number of
* locks
+ *
+ * @deprecated use {@link
CloudHttp2SolrClient.Builder#setParallelCacheRefreshes(int)} instead
*/
+ @Deprecated
public void setParallelCacheRefreshes(int n) {
locks = objectList(n);
}