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

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Jzjsnow
Copy link
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
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.

.longType()
.defaultValue(30000L)
.durationType()
.defaultValue(Duration.ofSeconds(30))
Copy link
Member

Choose a reason for hiding this comment

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

If a user sets this conf to 60000 before this commit, and he/she needs to adjust the config to 60, am I understanding right? if it is true, can we still use millisecond as the unit in the current commit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not exactly, the default unit for all time-related configuration items is currently milliseconds, which is consistent with the pre-commit default unit, except for the configuration item terminal.session.timeout. For terminal.session.timeout, the default unit is minutes before this commit and milliseconds after the commit. I think this change should be highlighted in the release logs or upgrade scripts indeed.

import java.util.Map;

public class TestAmoroManagementConf {
private static final ConfigOption<Duration>[] TIME_RELATED_CONFIG_OPTIONS =
Copy link
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
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.

jzjsnow added 2 commits February 5, 2025 18:10
…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

codecov-commenter commented Feb 5, 2025

Codecov Report

Attention: 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 1 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.

…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants