-
Notifications
You must be signed in to change notification settings - Fork 739
Migrate to dot seperate naming of environment variables #3312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Great initiative. Warning is a nice thing to add since it is easy in a centralized way, but not strictly required if this is a 10.0 PR and the prop change is documented. |
It's not clear this is needed or matters. In the code I like seeing "solr.<module>.<name>" where the module and name are camel case. But I can get over it. |
Humm, so in messing with this, I am seeing that the properties that I've removed only get set by bin/solr scripts, so maybe they are all internal to Solr? |
Thanks for the honest feedback ;-). I'm happy to elaborate on reasons why if helpful ;-) |
…ile.types Use EnvUtils to simplify consulting properties or env variables.
Converts non standard old system properties into the current standard and warns users about upgrading.
Adds a bats test to show the deprecated value still works, but emits a warning to the user.
Yeah, I'm not sure this is better (and definitely not sure if its worth the effort) |
We should probably make sure we are all on the same page, before I keep plugging away on this. I, maybe erroneously, assumed that since there was a TODO in the https://github.com/apache/solr/blob/main/solr/solrj/src/resources/EnvToSyspropMappings.properties#L6 file that this was something as a community we had agreed on. Since Solr 10 is coming, I wanted to get this in! I may over value consistency! |
Okay, before I polish off migrating the rest of the ones in https://github.com/apache/solr/pull/3312/files#diff-012f0766c431d2622a99ac1f70addc1d1f90106816a94434a39db6945db23601, I think this should probably get merged, and then I can do a second batch...? |
This PR has had no activity for 60 days and is now labeled as stale. Any new activity will remove the stale label. To attract more reviewers, please tag people who might be familiar with the code area and/or notify the [email protected] mailing list. To exempt this PR from being marked as stale, make it a draft PR or add the label "exempt-stale". If left unattended, this PR will be closed after another 60 days of inactivity. Thank you for your contribution! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In SIP-21 (https://cwiki.apache.org/confluence/display/SOLR/System+property+naming+structure) I proposed a solr.<top-cat>.<sub-cat>.<prop>.<name>
structure to give users some clue as to which part of solr a variable is for. It was a bit hard to agree on sensible top- and sub-categories, but I gave it a first shot. I made some comments below for how that would change this PR.
Also the comment in the props file was made assuming the community agrees to go this direction. The feedback from the SIP process was largely positive, and I know that more recently named variables have tried to follow this pattern, but no enforcement until you proposed this PR, which I support.
@@ -1766,7 +1766,7 @@ private SolrCore createFromDescriptor( | |||
// this mostly happens when the core is deleted when this node is down | |||
// but it can also happen if connecting to the wrong zookeeper | |||
final boolean deleteUnknownCores = | |||
Boolean.parseBoolean(System.getProperty("solr.deleteUnknownCores", "false")); | |||
Boolean.parseBoolean(System.getProperty("solr.delete.unknown.cores", "false")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
solr.cloud.startup.delete.unknown.cores.enabled
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see that this is a painfully long prop, and I kind of agree with Smiley that solr.cloud.startup.deleteUnknownCores
would be a better choice. But allowing CamelCase breaks the simple translation rule that you can take an env.var and lowercase it and replace underscores with dots to get the sysprop. Perhaps we could introduce dashes like SOLR_CLOUD_STARTUP_DELETE-UNKNOWN-CORES
but it soon gets to complex. Naming has been and is a hard thing.
I'm personally willing to embrace structure and simplified rules for parsing/mapping and sacrifice some readability or brewity. Perhaps further down the road we could build one very simple config parser that instantiates config objects without all the bolier-plate parsing code we have today.
@@ -334,7 +334,7 @@ public String getHeader() { | |||
"Note: (a) Please add '--solr-url http://host:port' parameter if needed (usually on Windows)."); | |||
format( | |||
sb, | |||
" (b) Please make sure that all Solr nodes are started with '-Denable.packages=true' parameter."); | |||
" (b) Please make sure that all Solr nodes are started with '-Dsolr.enable.packages=true' parameter."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
solr.packages.enabled
?
private static final boolean disabled = | ||
Boolean.parseBoolean(System.getProperty("disableAdminUI", "false")); | ||
Boolean.parseBoolean(System.getProperty("solr.admin.ui.disabled", "false")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
solr.ui.disabled
?
enableRemoteStreams = Boolean.getBoolean("solr.enableRemoteStreaming"); | ||
enableStreamBody = Boolean.getBoolean("solr.enableStreamBody"); | ||
enableRemoteStreams = Boolean.getBoolean("solr.enable.remote.streaming"); | ||
enableStreamBody = Boolean.getBoolean("solr.enable.stream.body"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
solr.requests.streaming.remote.enabled
and solr.requests.streaming.body.enabled
?
InputStream stream2 = | ||
EnvUtils.class | ||
.getClassLoader() | ||
.getResourceAsStream("EnvToSyspropDeprecatedMappings.properties")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More meaninful variable names than stream
and stream2
.
The file name EnvToSyspropDeprecatedMappings.properties
gives impression that this file maps env.variables to sys props, but the file itself says it maps sys props to sys props?
Q: Would it be possible to add deprecations as a section in the existing properties file, perhaps with a prefix deprecated.*
to keep it in one place?
Thanks for letting oking at this! I had tuna but out of steam on it but will try and pick it up again and get this batch of changes in. Definitely 10x change. |
https://issues.apache.org/jira/browse/SOLR-XXXXX
Description
Replace legacy property names with the modern default dot notation.
Solution
This started out of some exploration of how to merge the
solr.in.sh
andsolr.in.cmd
files, and branched off from there.I found that if we replaced the legacy variable names (that are mapped in
EnvToSyspropMappings.properties
) then we could simplify some of the code.A question, do we need a deprecation type warning if this change is 10x only? One idea I had is that instead or removing the mappings from
EnvToSyspropMappings.properties
, we could instead have two lists. And if you use the value from the deprecated list, then you get a loud warning in the logs, with the idea that it gets removed in 11?Tests
Running existing tests. If we add the warning idea, then will need another test.