Skip to content

host -> solr.host.advertise in EnvToSyspropMappings - #4715

Draft
msternermxy wants to merge 4 commits into
apache:mainfrom
msternermxy:fix-solr-18337
Draft

host -> solr.host.advertise in EnvToSyspropMappings#4715
msternermxy wants to merge 4 commits into
apache:mainfrom
msternermxy:fix-solr-18337

Conversation

@msternermxy

@msternermxy msternermxy commented Aug 6, 2026

Copy link
Copy Markdown

Fixes https://issues.apache.org/jira/browse/SOLR-18337

Description

During the implementation of SIP-21, host seems to have been mistakenly left in as the system property mapped to SOLR_HOST_ADVERTISE instead of the non-deprecated solr.host.advertise.

Solution

Removing the host to solr.host.advertise mapping from EnvToSyspropMappings.properties.

Tests

I have not tested the fix.

Checklist

Please review the following and check all that apply:

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • I have created a Jira issue and added the issue ID to my pull request title.
  • I have given Solr maintainers access to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation)
  • I have developed this patch against the main branch.
  • I have run ./gradlew check.
  • I have added tests for my changes.
  • I have added documentation for the Reference Guide
  • I have added a changelog entry for my change

@janhoy
janhoy requested a review from epugh August 6, 2026 17:34
@dsmiley

dsmiley commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

glad to see this getting fixed; I've noticed this warning lately when running Solr

SOLR_HIDDEN_SYS_PROPS=solr.hiddenSysProps
SOLR_HOME=solr.solr.home
SOLR_HOST_ADVERTISE=host
SOLR_HOST_ADVERTISE=solr.host.advertise

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

huh... I was under the impression that this was needed for NON-STANDARD mappings. I will dig in more. I assumed that all caps underscroe would convert. I notice however that we also have SOLR_HIDDEN_SYS_PROPS, and I didn't think it would be needed.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

In that case it sounds like removing the line is better. A suitable regression test would be to verify that no mappings in EnvToSyspropMappings.properties result in deprecated system properties in DeprecatedSystemPropertyMappings.properties (as was the case here).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

want to try it? I'm going to dig more in and see if maybe there is a bug in how we handle the mappings. Let me know!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's common for HOST env to be defined automatically. Definitely doesn't mean the Solr user has an outdated mapping.
We could add a custom rule to default solr.host.name from HOST env.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

okay, chatted with Claude, and your intuition @msternermxy is right. We don't need SOLR_HOST_ADVERTISE=solr.host.advertise, it doesn't hurt anything, but doesn't do anything at all as well. I am checking some other settings in this file as well.

@HoustonPutman

Copy link
Copy Markdown
Contributor

…warnings

Several other EnvToSyspropMappings.properties entries had the same bug as
SOLR_HOST_ADVERTISE: they pointed at a legacy/intermediate sysprop name that
DeprecatedSystemPropertyMappings.properties also treats as deprecated, so
setting the env var tripped EnvUtils' own deprecation-forwarding logic on
itself, producing a confusing warning even though the value still resolved
correctly via that indirection.
@github-actions github-actions Bot added the tests label Aug 8, 2026
* deliberately excluded here: it shares a target sysprop with that other test, and this test
* would clobber it with a non-boolean value depending on random test execution order.
*
* <p>The LogListener is scoped to only these six properties' names (rather than listening for

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I was on the fence about this test, both all the comments and the use of loglisterner, but since this bug was "already there" and didn't get caught, I liked having this very much more rigourse test.

# CamelCase properties are mapped to dot separated lowercase
# This way, env SOLR_FOO_BAR will also match property 'solr.foo.bar' without a mapping in this file
# TODO: Deprecate non-standard sysprops and standardize on solr.foo.bar in Solr 10
# Mapping from Environment variable to system property.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

redoing this comment to make it clear hopefully for the future

SOLR_ALWAYS_ON_TRACE_ID=solr.alwaysOnTraceId
SOLR_AUTH_JWT_ALLOW_OUTBOUND_HTTP=solr.auth.jwt.allowOutboundHttp
SOLR_HIDDEN_SYS_PROPS=solr.hiddenSysProps
SOLR_ALWAYS_ON_TRACE_ID=solr.tracing.always.on.enabled

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

turns out the pattern that avoids "double hops" is to use the permanant property name. not the old name that then needs another hop of conversion!

@epugh

epugh commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

So I agree, this should be removed since "host" has been deprecated for a while and now removed. But there are a few places in the code that it needs to be fixed.

https://github.com/apache/solr/blob/main/solr/core/src/java/org/apache/solr/util/tracing/SimplePropagator.java#L45 https://github.com/apache/solr/blob/main/solr/modules/opentelemetry/src/java/org/apache/solr/opentelemetry/OtelTracerConfigurator.java#L77-L79 https://github.com/apache/solr/blob/main/solr/solrj/src/test/org/apache/solr/common/util/EnvUtilsTest.java#L82

I think those are the last remnants.

#c8c5142bcc8521c01ccd0a93b424c885885cd70e has these changes...

1 similar comment
@epugh

epugh commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

So I agree, this should be removed since "host" has been deprecated for a while and now removed. But there are a few places in the code that it needs to be fixed.

https://github.com/apache/solr/blob/main/solr/core/src/java/org/apache/solr/util/tracing/SimplePropagator.java#L45 https://github.com/apache/solr/blob/main/solr/modules/opentelemetry/src/java/org/apache/solr/opentelemetry/OtelTracerConfigurator.java#L77-L79 https://github.com/apache/solr/blob/main/solr/solrj/src/test/org/apache/solr/common/util/EnvUtilsTest.java#L82

I think those are the last remnants.

#c8c5142bcc8521c01ccd0a93b424c885885cd70e has these changes...

@epugh

epugh commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

@msternermxy i hope it was okay I pushed up some changes.... would love a review @dsmiley @HoustonPutman ...

// These have different names than the environment variables
assertEquals(ENV.get("SOLR_HOME"), EnvUtils.getProperty("solr.solr.home"));
assertEquals(ENV.get("SOLR_HOST_ADVERTISE"), EnvUtils.getProperty("host"));
assertEquals(ENV.get("SOLR_HOST_ADVERTISE"), EnvUtils.getProperty("solr.host.advertise"));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This changed assertion no longer makes sense in this test method

Asserting that no system property mapped from an environment variable by EnvToSyspropMappings.properties is deprecated by DeprecatedSystemPropertyMappings.properties.
@msternermxy

Copy link
Copy Markdown
Author

@msternermxy i hope it was okay I pushed up some changes....

Of course! Seems my oneliner draft PR served its purpose well, even though not a single line of it remains... :-) I additionally added the regression test I had in mind, based on cross-verifying the two properties files.

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.

4 participants