You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "dsmiley (via GitHub)" <gi...@apache.org> on 2025/11/17 23:00:40 UTC
[PR] SOLR-17994: SolrClientCustomizer rename [solr]
dsmiley opened a new pull request, #3876:
URL: https://github.com/apache/solr/pull/3876
Rename HttpClientBuilderFactory to SolrClientCustomizer, and property solr.httpclient.builder.factory to solr.solrj.http.customizer
https://issues.apache.org/jira/browse/SOLR-17994
This somewhat fits into the separation of a solrj-jetty.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] SOLR-17994: SolrClientCustomizer rename [solr]
Posted by "gerlowskija (via GitHub)" <gi...@apache.org>.
gerlowskija commented on code in PR #3876:
URL: https://github.com/apache/solr/pull/3876#discussion_r2573656857
##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrHttpConstants.java:
##########
@@ -42,17 +42,11 @@ public interface SolrHttpConstants {
/** Maximum total connections allowed */
String PROP_MAX_CONNECTIONS = "maxConnections";
- /**
- * A Java system property to select the {@linkplain HttpClientBuilderFactory} used for configuring
- * HTTP based SolrClients.
- */
- String SYS_PROP_HTTP_CLIENT_BUILDER_FACTORY = "solr.httpclient.builder.factory";
Review Comment:
Good idea, +1
##########
solr/bin/solr:
##########
@@ -342,7 +342,7 @@ fi
if [ -n "${SOLR_AUTH_TYPE:-}" ]; then
case "$(echo "$SOLR_AUTH_TYPE" | awk '{print tolower($0)}')" in
basic)
- SOLR_AUTHENTICATION_CLIENT_BUILDER="org.apache.solr.client.solrj.impl.PreemptiveBasicAuthClientBuilderFactory"
+ SOLR_AUTHENTICATION_CLIENT_BUILDER="org.apache.solr.client.solrj.impl.PreemptiveBasicAuthClientCustomizer"
Review Comment:
+1, renaming this prop makes sense to me since there's no "builder" involved here any more. Ditto for "AUTHC_CLIENT_BUILDER_ARG" below.
##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/PreemptiveBasicAuthClientCustomizer.java:
##########
@@ -66,15 +68,15 @@ public static void setDefaultSolrParams(SolrParams params) {
}
@Override
- public void close() throws IOException {}
-
- @Override
- public void setup(Http2SolrClient client) {
+ public void setup(SolrClient client) {
+ if (client instanceof Http2SolrClient == false) {
+ return;
+ }
Review Comment:
[-0] I agree that putting "jetty" in the sysprop helps somewhat to disambiguate the client type being targeted. Though that's really not my primary concern.
My main interest here is around the Java API / signature itself. It feels to me like the type-widening results in a Java API that's easier for a SolrJ user to misuse, and harder for a Solr developer to implement than it was before.
I *think* we're doing this in order to make the interface flexible enough to customize JDK clients in the future? But if that's the goal, maybe we'd be better off keeping this signature as-is for now, and instead adding a `setup(HttpJdkSolrClient client)` down the road if/when we actually try to add support for customizing those JDK clients.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] SOLR-17994: SolrClientCustomizer rename [solr]
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on code in PR #3876:
URL: https://github.com/apache/solr/pull/3876#discussion_r2537930918
##########
solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc:
##########
@@ -83,7 +83,7 @@ Users who previously relied on collection-specific URLs to avoid including the c
This makes it clear that they pertain specifically to “JavaBin” rather than binary in general.
* The deprecated SolrClient implementations based on Apache HttpClient are removed from Solrj, thus the related dependencies are no longer present.
-The system property `solr.httpclient.builder.factory` now only configures SolrClients using a Jetty based HttpClient.
+The system property `solr.solrj.http.customizer` (formerly `solr.httpclient.builder.factory`) now only configures SolrClients using a Jetty based HttpClient.
Review Comment:
We haven't done in ref guide any "formerly known" language out side of the Solr properties ref guide page for all the renamed props.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] SOLR-17994: SolrClientCustomizer rename [solr]
Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley commented on PR #3876:
URL: https://github.com/apache/solr/pull/3876#issuecomment-3575785139
@gerlowskija if you only have time to review one of my PRs... this is one where more review would be better.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] SOLR-17994: SolrClientCustomizer rename [solr]
Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley commented on code in PR #3876:
URL: https://github.com/apache/solr/pull/3876#discussion_r2535828526
##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/PreemptiveBasicAuthClientCustomizer.java:
##########
@@ -66,15 +68,15 @@ public static void setDefaultSolrParams(SolrParams params) {
}
@Override
- public void close() throws IOException {}
-
- @Override
- public void setup(Http2SolrClient client) {
+ public void setup(SolrClient client) {
+ if (client instanceof Http2SolrClient == false) {
+ return;
+ }
Review Comment:
@gerlowskija , responding to your feedback:
The code here isn't really different than the behavior today -- if you set the sys prop, it only applies to Http2SolrClient (Jetty). If we start using this mechanism at not only the Http SolrClient level but also CloudSolrClient or whatever else that may or may not apply to this customizer, then it should skip it. But I get your concern. Perhaps the property should reflect the usage... so `solr.solrj.http.jetty.customizer` vs `solr.solrj.http.jdk.customizer` (hypothetical). With this approach, the implementation should throw an exception if the type is wrong. And the implementation should reflect it as well, like putting "Jetty" into `PreemptiveBasicAuthClientJettyCustomizer`. LMK what you think; I'd prefer this way.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] SOLR-17994: SolrClientCustomizer rename [solr]
Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley commented on code in PR #3876:
URL: https://github.com/apache/solr/pull/3876#discussion_r2573957180
##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/PreemptiveBasicAuthClientCustomizer.java:
##########
@@ -66,15 +68,15 @@ public static void setDefaultSolrParams(SolrParams params) {
}
@Override
- public void close() throws IOException {}
-
- @Override
- public void setup(Http2SolrClient client) {
+ public void setup(SolrClient client) {
+ if (client instanceof Http2SolrClient == false) {
+ return;
+ }
Review Comment:
Perhaps it's a matter of taste, but I'd rather have a common interface with one setup method (as I propose here), than either multiple type-specific classes or type-specific methods. Perhaps adding generics would help slightly, in terms of making an implementation clearly for a specific type. Yeah.
> My main interest here is around the Java API / signature itself. It feels to me like the type-widening results in a Java API that's easier for a SolrJ user to misuse, and harder for a Solr developer to implement than it was before.
I don't agree/understand this concern. I'll update this PR soon-ish after another big PR lands. Perhaps you'll feel better about it. If you don't; I'm ready to give up and do what you think I should do (which I'm not 100% clear on what that is).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] SOLR-17994: SolrClientCustomizer rename [solr]
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on code in PR #3876:
URL: https://github.com/apache/solr/pull/3876#discussion_r2537924335
##########
solr/solr-ref-guide/modules/configuration-guide/pages/solr-properties.adoc:
##########
@@ -102,18 +96,20 @@ NOTE: Properties marked with "!" indicate inverted meaning between pre Solr 10 a
|solr.security.allow.urls|solr.allowUrls||A comma seperated list of urls for reading from.
-|solr.security.allow.urls.enabled|!solr.disable.allow.urls|false|If using an allow list of accessible urls is enabled.
+|solr.security.allow.urls.enabled|!solr.disable.allow.urls|false|If using an allow list of accessible urls is enabled.
+
|solr.security.auth.plugin|authenticationPlugin||Specifies the authentication plugin to use.
|solr.solrj.cloud.max.stale.retries|cloudSolrClientMaxStaleRetries|5|Sets the maximum number of retries for stale connection attempts in SolrJ cloud client.
-|solr.solrj.http.cookies.enabled|!solr.http.disableCookies| false |If Http2SolrClient should support cookies.
+|solr.solrj.http.customizer|solr.httpclient.builder.factory||A class loaded to customize HttpJettySolrClient upon creation.
Review Comment:
Makes sense
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] SOLR-17994: SolrClientCustomizer rename [solr]
Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley merged PR #3876:
URL: https://github.com/apache/solr/pull/3876
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] SOLR-17994: SolrClientCustomizer rename [solr]
Posted by "gerlowskija (via GitHub)" <gi...@apache.org>.
gerlowskija commented on code in PR #3876:
URL: https://github.com/apache/solr/pull/3876#discussion_r2576906295
##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/PreemptiveBasicAuthClientCustomizer.java:
##########
@@ -66,15 +68,15 @@ public static void setDefaultSolrParams(SolrParams params) {
}
@Override
- public void close() throws IOException {}
-
- @Override
- public void setup(Http2SolrClient client) {
+ public void setup(SolrClient client) {
+ if (client instanceof Http2SolrClient == false) {
+ return;
+ }
Review Comment:
I'll try to be as specific as I can:
When I see an interface name that includes 'SolrClient' and a single method that consumes a `SolrClient`, it implies to me that implementations will be able to handle any old 'SolrClient' I might pass in. And that's 100% *not* the case. Our out-of-the-box implementations are very Http2SolrClient specific, going so far as to throw an exception if given a different type of client.
To argue from a parallel case: Java's [List.removeAll](https://docs.oracle.com/javase/8/docs/api/java/util/List.html#removeAll-java.util.Collection-) method consumes a "Collection" of elements to remove. Java users see that and assume that List implementations are ambivalent to the specific type of Collection passed in.
They'd find it very trappy if `ArrayList.removeAll` actually only supported `SortedSet` parameters and threw an exception when anything else was passed in. IMO that's kindof what we're doing with SolrClientCustomizer here: promising to handle a much broader type than we actually support in practice.
> I'm ready to give up and do what you think I should do (which I'm not 100% clear on what that is)
Don't give up - I approved the PR because I trusted your judgement and would be happy to live with this PR landing "as is". You've done your due-diligence in hearing me out - if I haven't convinced you, just merge it. Don't make the change just for my sake 😛
On what I prefer: I really like the idea you sketched above. Give the interface declaration a type parameter, so that implementations can declare which subset of SolrClient they support (e.g. `class PreemptiveBasicAuthClientCustomizer implements SolrClientCustomizer<Http2SolrClient>`).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] SOLR-17994: SolrClientCustomizer rename [solr]
Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley commented on code in PR #3876:
URL: https://github.com/apache/solr/pull/3876#discussion_r2535764577
##########
solr/bin/solr:
##########
@@ -342,7 +342,7 @@ fi
if [ -n "${SOLR_AUTH_TYPE:-}" ]; then
case "$(echo "$SOLR_AUTH_TYPE" | awk '{print tolower($0)}')" in
basic)
- SOLR_AUTHENTICATION_CLIENT_BUILDER="org.apache.solr.client.solrj.impl.PreemptiveBasicAuthClientBuilderFactory"
+ SOLR_AUTHENTICATION_CLIENT_BUILDER="org.apache.solr.client.solrj.impl.PreemptiveBasicAuthClientCustomizer"
Review Comment:
perhaps this env var should be renamed too
##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java:
##########
@@ -186,16 +187,15 @@ private void initAuthStoreFromExistingClient(HttpClient httpClient) {
this.authenticationStore = (AuthenticationStoreHolder) httpClient.getAuthenticationStore();
}
- private void applyHttpClientBuilderFactory() {
- String factoryClassName =
- System.getProperty(SolrHttpConstants.SYS_PROP_HTTP_CLIENT_BUILDER_FACTORY);
+ private void applyClientCustomizer() {
+ String factoryClassName = EnvUtils.getProperty(SolrClientCustomizer.CLIENT_CUSTOMIZER_SYSPROP);
if (factoryClassName != null) {
- log.debug("Using Http Builder Factory: {}", factoryClassName);
- HttpClientBuilderFactory factory;
+ log.debug("Using {}", factoryClassName);
+ SolrClientCustomizer factory;
Review Comment:
TODO rename to `instance`
##########
solr/solr-ref-guide/modules/configuration-guide/pages/solr-properties.adoc:
##########
@@ -102,18 +96,20 @@ NOTE: Properties marked with "!" indicate inverted meaning between pre Solr 10 a
|solr.security.allow.urls|solr.allowUrls||A comma seperated list of urls for reading from.
-|solr.security.allow.urls.enabled|!solr.disable.allow.urls|false|If using an allow list of accessible urls is enabled.
+|solr.security.allow.urls.enabled|!solr.disable.allow.urls|false|If using an allow list of accessible urls is enabled.
+
|solr.security.auth.plugin|authenticationPlugin||Specifies the authentication plugin to use.
|solr.solrj.cloud.max.stale.retries|cloudSolrClientMaxStaleRetries|5|Sets the maximum number of retries for stale connection attempts in SolrJ cloud client.
-|solr.solrj.http.cookies.enabled|!solr.http.disableCookies| false |If Http2SolrClient should support cookies.
+|solr.solrj.http.customizer|solr.httpclient.builder.factory||A class loaded to customize HttpJettySolrClient upon creation.
Review Comment:
`HttpJettySolrClient` slipped in here... hasn't been renamed from Http2SolrClient yet
##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java:
##########
@@ -186,16 +187,15 @@ private void initAuthStoreFromExistingClient(HttpClient httpClient) {
this.authenticationStore = (AuthenticationStoreHolder) httpClient.getAuthenticationStore();
}
- private void applyHttpClientBuilderFactory() {
- String factoryClassName =
- System.getProperty(SolrHttpConstants.SYS_PROP_HTTP_CLIENT_BUILDER_FACTORY);
+ private void applyClientCustomizer() {
+ String factoryClassName = EnvUtils.getProperty(SolrClientCustomizer.CLIENT_CUSTOMIZER_SYSPROP);
Review Comment:
now using EnvUtils; should now work consistently with the env var pattern if someone wishes
##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrHttpConstants.java:
##########
@@ -42,17 +42,11 @@ public interface SolrHttpConstants {
/** Maximum total connections allowed */
String PROP_MAX_CONNECTIONS = "maxConnections";
- /**
- * A Java system property to select the {@linkplain HttpClientBuilderFactory} used for configuring
- * HTTP based SolrClients.
- */
- String SYS_PROP_HTTP_CLIENT_BUILDER_FACTORY = "solr.httpclient.builder.factory";
Review Comment:
I felt this was better organized on the class that loads it. I can change back if asked.
##########
solr/solrj/src/java/org/apache/solr/client/solrj/SolrClientCustomizer.java:
##########
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.client.solrj;
+
+/**
+ * A config hook for post-configuration of a {@linkplain SolrClient} by its builder. It is not
+ * supported by all builders.
+ *
+ * @see #CLIENT_CUSTOMIZER_SYSPROP
+ * @lucene.experimental
+ */
+public interface SolrClientCustomizer {
+ /**
+ * A Java system property to select the {@linkplain SolrClientCustomizer} used for configuring
+ * HTTP based SolrClients.
+ */
+ String CLIENT_CUSTOMIZER_SYSPROP = "solr.solrj.http.customizer";
+
+ void setup(SolrClient client);
Review Comment:
No longer mandate a specific type of SolrClient
##########
solr/solrj/src/java/org/apache/solr/client/solrj/SolrClientCustomizer.java:
##########
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.client.solrj;
+
+/**
+ * A config hook for post-configuration of a {@linkplain SolrClient} by its builder. It is not
+ * supported by all builders.
+ *
+ * @see #CLIENT_CUSTOMIZER_SYSPROP
+ * @lucene.experimental
+ */
+public interface SolrClientCustomizer {
Review Comment:
doesn't need to be Closeable!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org