Skip to content
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

Apply both environment variables and system properties to user and table config #13011

Conversation

xiangfu0
Copy link
Contributor

Apply both environment variables and system properties to user and table configs.
Environment variables take precedence over system properties.

@codecov-commenter
Copy link

codecov-commenter commented Apr 26, 2024

Codecov Report

Attention: Patch coverage is 71.42857% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 62.16%. Comparing base (59551e4) to head (499eec2).
Report is 374 commits behind head on master.

Files Patch % Lines
.../java/org/apache/pinot/spi/config/ConfigUtils.java 75.00% 3 Missing ⚠️
...ache/pinot/common/metadata/ZKMetadataProvider.java 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #13011      +/-   ##
============================================
+ Coverage     61.75%   62.16%   +0.41%     
+ Complexity      207      198       -9     
============================================
  Files          2436     2502      +66     
  Lines        133233   136670    +3437     
  Branches      20636    21164     +528     
============================================
+ Hits          82274    84963    +2689     
- Misses        44911    45419     +508     
- Partials       6048     6288     +240     
Flag Coverage Δ
custom-integration1 <0.01% <0.00%> (-0.01%) ⬇️
integration <0.01% <0.00%> (-0.01%) ⬇️
integration1 <0.01% <0.00%> (-0.01%) ⬇️
integration2 0.00% <0.00%> (ø)
java-11 62.13% <71.42%> (+0.43%) ⬆️
java-21 35.06% <71.42%> (-26.57%) ⬇️
skip-bytebuffers-false 62.15% <71.42%> (+0.40%) ⬆️
skip-bytebuffers-true 35.04% <71.42%> (+7.31%) ⬆️
temurin 62.16% <71.42%> (+0.41%) ⬆️
unittests 62.16% <71.42%> (+0.41%) ⬆️
unittests1 46.74% <71.42%> (-0.15%) ⬇️
unittests2 27.92% <0.00%> (+0.19%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

public static <T extends BaseJsonConfig> T applyConfigWithEnvVariablesAndSystemProperties(T config) {
Map<String, String> combinedMap = new HashMap<>();
// Add all system properties to the map
System.getProperties().forEach((key, value) -> combinedMap.put(String.valueOf(key), String.valueOf(value)));
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the overhead high to dynamically load system properties for each config read?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is not happening all the time, so the overhead is not that much.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm thinking maybe we can periodically pull it, but we can iterate if we find this becomes blocker

@@ -85,7 +85,7 @@ public void testIndexing() {
ImmutableMap.of("LOAD_MODE", "MMAP", "AWS_ACCESS_KEY", "default_aws_access_key", "AWS_SECRET_KEY",
"default_aws_secret_key");

indexingConfig = ConfigUtils.applyConfigWithEnvVariables(environment, indexingConfig);
indexingConfig = ConfigUtils.applyConfigWithEnvVariablesAndSystemProperties(environment, indexingConfig);
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we add some value to the system properties and test out the behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added.

…and table configs, Environment variables take precedence over system properties
@xiangfu0 xiangfu0 force-pushed the use-both-env-var-and-system-props-to-apply-config-template branch from aab7de4 to 499eec2 Compare April 27, 2024 03:07
@xiangfu0 xiangfu0 merged commit 0be51ca into apache:master Apr 27, 2024
20 checks passed
@xiangfu0 xiangfu0 deleted the use-both-env-var-and-system-props-to-apply-config-template branch April 27, 2024 06:22
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.

None yet

3 participants