Skip to content

[AMORO-3418] Optimize ams configuration to support parsing of time and storage unit#3423

Merged
zhoujinsong merged 3 commits intoapache:masterfrom
Jzjsnow:optimize_ams_configuration
Feb 10, 2025
Merged

[AMORO-3418] Optimize ams configuration to support parsing of time and storage unit#3423
zhoujinsong merged 3 commits intoapache:masterfrom
Jzjsnow:optimize_ams_configuration

Conversation

@Jzjsnow
Copy link
Copy Markdown
Contributor

@Jzjsnow Jzjsnow commented Jan 23, 2025

Why are the changes needed?

The time-related configuration items in the current ams configuration are inconsistent in type, with both Long and Duration types. This results in users having to convert to milliseconds when using these Long types, which is not user friendly.

In addition, storage-related parameters such as thrift-server.max-message-size only support Long type (default unit is byte). It would be more user-friendly to support user-specified units, as in the Apache Flink configuration.

Close #3418.

Brief change log

  • Adjust the data type of all time-related configuration items to Duration.
  • Support for setting memory units for storage related items.

How was this patch tested?

  • Add some test cases that check the changes thoroughly including negative and positive cases if possible

  • Add screenshots for manual tests if appropriate

  • Run test locally before making a pull request

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

@github-actions github-actions bot added the module:ams-server Ams server module label Jan 23, 2025
@klion26 klion26 force-pushed the optimize_ams_configuration branch from 53ed46f to d6efb5a Compare February 5, 2025 02:19
Copy link
Copy Markdown
Member

@klion26 klion26 left a comment

Choose a reason for hiding this comment

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

@Jzjsnow thanks for the contribution, left some comments, please take another look when you're free.

import java.util.Map;

public class TestAmoroManagementConf {
private static final ConfigOption<Duration>[] TIME_RELATED_CONFIG_OPTIONS =
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need to add a test to cover the migration for the changed configs? so that we know this does not change the user behavior, or if the behavior is indeed needed, we need to add them to the release note so that the user can know it(maybe add a upgrade script is better)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have added a unit test to parse the old version of the config file in the latest commit. The parsing result is as expected after adding a unit suffix to the original values of the old config file, which might serve as a reference for the upgrade scripts.

…terval and storage related configuration items when both values and units are specified
…time interval and storage related configuration items when both values and units are specified
@Jzjsnow Jzjsnow force-pushed the optimize_ams_configuration branch from d6efb5a to bf94632 Compare February 5, 2025 10:10
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Feb 5, 2025

Codecov Report

❌ Patch coverage is 87.75510% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 27.78%. Comparing base (66a5254) to head (1d4337e).
⚠️ Report is 321 commits behind head on master.

Files with missing lines Patch % Lines
...in/java/org/apache/amoro/config/ConfigHelpers.java 0.00% 5 Missing ⚠️
...in/java/org/apache/amoro/config/ConfigOptions.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3423      +/-   ##
============================================
+ Coverage     21.80%   27.78%   +5.97%     
- Complexity     2353     3591    +1238     
============================================
  Files           431      602     +171     
  Lines         39948    48678    +8730     
  Branches       5655     6274     +619     
============================================
+ Hits           8712    13524    +4812     
- Misses        30504    34214    +3710     
- Partials        732      940     +208     
Flag Coverage Δ
core 27.78% <87.75%> (?)
trino ?

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…time interval and storage related configuration items when both values and units are specified
@Jzjsnow Jzjsnow force-pushed the optimize_ams_configuration branch from bf94632 to 1d4337e Compare February 5, 2025 10:41
@zhoujinsong
Copy link
Copy Markdown
Contributor

@Jzjsnow Thanks for the contribution!

The support for time and memory configuration units is a great improvement.
It seems that the new configuration ensures a certain level of compatibility with the old configurations, except for terminal.session.timeout. We can mention this in the new version's release notes.

Besides, there are some places we should upgrade to the new version example:

  • dist/src/main/amoro-bin/conf/config.yaml
  • charts/amoro/templates/common/amoro-configmap.yaml

Copy link
Copy Markdown
Member

@klion26 klion26 left a comment

Choose a reason for hiding this comment

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

The change LGTM % test variable, thanks for the contribution.

@zhoujinsong with the change to TERMINAL_SESSION_TIMEOUT, should we plan for an upgrade script or anything else?
It seems the last reply has answered my question. just saw it after send my comment.

.put(AmoroManagementConf.TERMINAL_SESSION_TIMEOUT.key(), "min")
.build();

private static final ConfigOption<String>[] STORAGE_RELATED_CONFIG_OPTIONS =
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This needs to be updated to ConfigOption<MemorySize>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

4 participants