Skip to content

Conversation

@dsmiley
Copy link
Contributor

@dsmiley dsmiley commented Jan 3, 2026

HttpShardHandlerFactory reads the urlScheme from configuration, defaulting to "http" if there is none. Most/all solr.xml's we have, including for tests, have this explicitly configured with urlScheme sys prop resolution. I think the factory should read that sys prop as a default, at least as a small improvement.

Ultimately, I'd like to see SOLR_SSL_ENABLED used within Solr and we default from that, as that is what the user sets. But I'll leave that for a proper JIRA issue.

STCJ4 sets "urlScheme" and we should read it in HttpShardHandlerFactory as the default.  Don't assume a test solr.xml has this.
Comment on lines -20 to -21
import static org.apache.solr.common.cloud.ZkStateReader.HTTPS;
import static org.apache.solr.common.cloud.ZkStateReader.URL_SCHEME;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

STCJ4 should not be referencing SolrCloud stuff. Those constants are for ZkStateReader cluster properties, not test "urlScheme" which has no constant. That they are the same is a coincidence.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is an unfortunant coincidence, and it would be great to rename them to be more explciit, it's just so easy to get them confused, if we can't outright eliminate this..

@dsmiley
Copy link
Contributor Author

dsmiley commented Jan 4, 2026

note: this is intended to fix recent test failures from the premature change to have many tests no longer use a solr.xml, which results in creating one from purely internal coded defaults, which don't consider this system property (among many other things as well).

NamedList<?> args = info.initArgs;
this.scheme = getParameter(args, INIT_URL_SCHEME, null, sb);
// note: the sys prop is only used in testing
this.scheme = getParameter(args, INIT_URL_SCHEME, System.getProperty(INIT_URL_SCHEME), sb);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I totally believe you that this works, but it also just feels like a code smell.. why do we have to have a special magic property that is used in testing that is set up in this random method!

Copy link
Contributor Author

@dsmiley dsmiley Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I sympathize -- I don't love non-test code consulting a test-only system property. I guess I shouldn't have even claimed this was test-only since --even our production solr.xml uses this property-- (edit -- false). Once solr.ssl.enabled is available, this code will change to look at that. At least that is well namespaced.

Copy link
Contributor

@epugh epugh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do open that JIRA that you want now so that it doesn't get lost! As far as this goes, while I see that it works, it does feel weird that we don't just properly configure a HttpshardHandlerFactory in a more natural way then a magic "test" hook.

@dsmiley dsmiley merged commit 6699580 into apache:main Jan 4, 2026
4 of 7 checks passed
@dsmiley dsmiley deleted the urlSchemeDefaultTests branch January 4, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants