SOLR-18055 Use solr.ssl.enabled property for url scheme detection#4272
SOLR-18055 Use solr.ssl.enabled property for url scheme detection#4272VishnuPriyaChandraSekar wants to merge 4 commits intoapache:mainfrom
Conversation
dsmiley
left a comment
There was a problem hiding this comment.
Thanks.
Remember to ./gradle writeChangelog too
| } | ||
|
|
||
| private void testUrlSchemeDefault(SolrZkClient client) throws Exception { | ||
| if (isSSLMode()) { |
There was a problem hiding this comment.
why are you this back & forth? in some methods?
There was a problem hiding this comment.
Looks like the baseClass (SolrTestCaseJ4) randomly runs the server in SSL mode. Thus, I had to put back the system property if the server runs in https (If I don't do this, the next consecutive tests becomes flaky)
| /** | ||
| * Deduce url scheme using environment variable if available otherwise from cluster property | ||
| * | ||
| * @return url scheme of host |
There was a problem hiding this comment.
Will add some in the next revision
| new RequestReplicaListTransformerGenerator(); | ||
|
|
||
| // URL scheme to be used in distributed search. | ||
| static final String INIT_URL_SCHEME = "urlScheme"; |
There was a problem hiding this comment.
Curious; was urlScheme arg documented in the ref guide or present in a published solr.xml that people use? If so we'll want to keep it.
There was a problem hiding this comment.
Looks like urlScheme is an optional field in solr.xml [1]. In order to provide backward compatibility, I think the precedence to lookup the urlScheme should be 1) solr.ssl.enabled 2) urlScheme from solr.xml 3) default (null).
[1] https://solr.apache.org/guide/solr/latest/configuration-guide/configuring-solr-xml.html
There was a problem hiding this comment.
I agree. Thanks for looking into it.
| @@ -1,8 +1,15 @@ | |||
| # See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc | |||
| title: Improved CloudSolrClient's urlScheme detection by using the scheme of provided Solr URLs, or looking at "solr.ssl.enabled". | |||
| title: Improved url scheme detection in client API and core components | |||
There was a problem hiding this comment.
IMO this has become much more vague to a reader of the changelog who is anyone other than you and me. The "title" label is misleading -- add more sentences.
There was a problem hiding this comment.
How about this "Standardize urlScheme detection with precedence for "solr.ssl.enabled" ?
| url: https://issues.apache.org/jira/browse/SOLR-18056 | ||
| - name: SOLR-18055 | ||
| url: https://issues.apache.org/jira/browse/SOLR-18055 | ||
| important_notes: |
There was a problem hiding this comment.
This is the first I've seen of this... and you are the first to attempt to use it :-) Our only references to it thus far don't even truly say what it's for.
Documentation. Seems for "breaking changes" or presumably anything befitting of that label. What you added doesn't qualify IMO.
Well the "deprecated" part does... albeit I think I said it's premature to deprecate that.
There was a problem hiding this comment.
Well, there is no other field I could use for.
Based on this, I will just have a self descriptive title (IMO this is the hardest part) like "Standardize urlScheme detection by prioritizing "solr.ssl.enabled" over solr.xml and cluster property"
| * | ||
| * <p>Examples: | ||
| * | ||
| * <ul> | ||
| * <li>Returns {@code "https"} when SSL is enabled via configuration. | ||
| * <li>Returns {@code null} when ssl is disabled or no explicit configuration is provided in | ||
| * solr.xml. | ||
| * </ul> |
There was a problem hiding this comment.
sorry, this is way too much documentation for a private method
| * | ||
| * @return http or https or null | ||
| */ | ||
| private String getUrlScheme(NamedList<?> args, StringBuilder sb) { |
There was a problem hiding this comment.
maybe prefix with 'init' not 'get' to emphasize this is for initialization and not any method in this class that might want it. On further reflection, there's getParameter called by init() a bunch of times. This method here was merely extracted from init(). You could put it back. Or call it getParameterUrlScheme
There was a problem hiding this comment.
That makes sense :)
https://issues.apache.org/jira/browse/SOLR-18055
Description
Currently, the client is compelled to provide cluster property in order to indicate the url scheme. This is annoying. In this PR, the url scheme is detected using the "solr.ssl.enabled" system property instead of cluster property.
Solution
Tests
- SolrTestCaseJ4.java
- TestMiniSolrCloudClusterSSL.java
Checklist
Please review the following and check all that apply:
mainbranch../gradlew check.