Skip to content

SOLR-18167: Fix the original PR #4507 to cover more use cases in mapping old to new system property names#4535

Open
epugh wants to merge 2 commits into
apache:mainfrom
epugh:SOLR-18167-part-deux
Open

SOLR-18167: Fix the original PR #4507 to cover more use cases in mapping old to new system property names#4535
epugh wants to merge 2 commits into
apache:mainfrom
epugh:SOLR-18167-part-deux

Conversation

@epugh

@epugh epugh commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

https://issues.apache.org/jira/browse/SOLR-18167

Description

test_start_solr.bats is failing!

Solution

Turns out the original PR didn't cover all the uses, and unfortuanntly the bats tests didn't get run by Github. Also, the nightly jenkins don't run them.

This fixes it, and adds another Java level unit test to verify the fix.

Tests

Update bats, add new JUnit.

cc @utsav00

@epugh

epugh commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

@utsav00 I'd love your review of this fix!

@epugh epugh requested a review from janhoy June 18, 2026 13:43

@dsmiley dsmiley left a comment

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.

why did Jenkins not run that test?

}
for (String key : deprecatedProps.stringPropertyNames()) {
DEPRECATED_MAPPINGS.put(deprecatedProps.getProperty(key), key);
// The lookup side (findDeprecatedMappingKey) normalises incoming "-D" keys to

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.

Suggested change
// The lookup side (findDeprecatedMappingKey) normalises incoming "-D" keys to
// The lookup side (findDeprecatedMappingKey) normalizes system properties to

Would that be just as correct?

public void deprecatedCamelCaseOldNameInMappingsFileIsTranslated() {
// Here the *old* name in the mappings file is itself camelCase (collection.configName), unlike
// deprecatedCamelCaseDFlagIsTranslatedToCurrentPropertyName where the file uses a dot-separated
// old name. Passing the camelCase old name verbatim as a -D flag must still be migrated. See

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.

In general, as a Java developer, I simply say "system property". I don't say "-D" flag... while yes I understand that is the argument to Java to pass them in on startup.

@janhoy janhoy left a comment

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.

LGTM

Comment on lines +78 to +80
// The lookup side (findDeprecatedMappingKey) normalises incoming "-D" keys to
// dot-separated form, so normalise the old (camelCase) names here too
DEPRECATED_MAPPINGS.put(camelCaseToDotSeparated(deprecatedProps.getProperty(key)), key);

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.

Oo, I like this idea more. I was going for a redundant check that required an extra guard - https://github.com/apache/solr/compare/main...utsav00:solr:fix/SOLR-18167?expand=1

@utsav00 utsav00 left a comment

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.

LGTM! Thanks for fixing my fix!

Comment on lines 229 to 239

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.

Not fix blocking but some small refactor: With this load time lookup normalization, we can remove these methods that were added in the initial fix and the original loop can be simplified again to

Suggested change
var dotKey = camelCaseToDotSeparated(deprecatedKey);
if (DEPRECATED_MAPPINGS.containsKey(dotKey) || DEPRECATED_MAPPINGS.containsKey("!" + dotKey)) {
applyDeprecatedPropertyMapping(deprecatedKey, dotKey, sysProperties);
}

}

@Test
public void deprecatedCamelCaseOldNameInMappingsFileIsTranslated() {

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 looks good. Can we also add a test for deprecated inverted camel case property to cover all the cases?

@epugh

epugh commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

@utsav00 you have some good ideas, do you want to push to my branch? I just added you as a collaborator on epugh/solr repo.

@epugh

epugh commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

why did Jenkins not run that test?

looks like it only runs "test" for solr-test-main.... Not iTest.

TST: add another test case
@epugh

epugh commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

@utsav00 thanks for the commit... Any other changes you want? I'll run the tests and then merge..

@epugh epugh self-assigned this Jun 19, 2026
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