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

feat(config): warn unrecognized field instead of panicking #8325

Merged
merged 10 commits into from Mar 8, 2023

Conversation

Gun9niR
Copy link
Contributor

@Gun9niR Gun9niR commented Mar 3, 2023

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

For backward compatibility, when we deprecate a config it should still be acceptable from the config file. A demo:

#[test]
fn test() {
    let c: RwConfig = toml::from_str(
        r#"
        ccc = "a"
        
        [batch]
        aaa = "??"

        [storage.file_cache]
        bbb = 1

        [storage]
        sstable_size_mb = 256
    "#,
    )
    .unwrap();
    warn_unrecognized_fields(&c);
}

Output is

unrecognized fields in config: ["ccc"]
unrecognized fields in config section [batch]: ["aaa"]
unrecognized fields in config section [storage.file_cache]: ["bbb"]

Checklist For Contributors

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • I have demonstrated that backward compatibility is not broken by breaking changes and created issues to track deprecated features to be removed in the future. (Please refer to the issue)
  • All checks passed in ./risedev check (or alias, ./risedev c)

Checklist For Reviewers

  • I have requested macro/micro-benchmarks as this PR can affect performance substantially, and the results are shown.

Documentation

  • My PR DOES NOT contain user-facing changes.
Click here for Documentation

Types of user-facing changes

Please keep the types that apply to your changes, and remove the others.

  • Installation and deployment
  • Connector (sources & sinks)
  • SQL commands, functions, and operators
  • RisingWave cluster configuration changes
  • Other (please specify in the release note below)

Release note

Unrecognized fields in the configuration file will generate a warning log instead of causing panic.

@Gun9niR Gun9niR requested review from xxchan, lmatz and fuyufjh March 3, 2023 08:16
@codecov
Copy link

codecov bot commented Mar 3, 2023

Codecov Report

Merging #8325 (608a910) into main (e6f2561) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main    #8325      +/-   ##
==========================================
- Coverage   71.62%   71.62%   -0.01%     
==========================================
  Files        1135     1135              
  Lines      185458   185468      +10     
==========================================
- Hits       132835   132833       -2     
- Misses      52623    52635      +12     
Flag Coverage Δ
rust 71.62% <0.00%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
src/common/src/config.rs 88.20% <0.00%> (-4.03%) ⬇️
src/meta/src/hummock/mock_hummock_meta_client.rs 64.43% <0.00%> (-1.04%) ⬇️
src/object_store/src/object/mod.rs 47.87% <0.00%> (-0.21%) ⬇️
src/storage/src/hummock/compactor/mod.rs 80.19% <0.00%> (-0.20%) ⬇️
src/common/src/cache.rs 97.15% <0.00%> (-0.11%) ⬇️
src/meta/src/hummock/manager/mod.rs 78.83% <0.00%> (-0.07%) ⬇️
src/storage/src/hummock/sstable_store.rs 64.35% <0.00%> (ø)
src/stream/src/executor/aggregation/minput.rs 96.27% <0.00%> (+0.10%) ⬆️
src/common/src/types/ordered_float.rs 32.81% <0.00%> (+0.19%) ⬆️
src/storage/src/hummock/compactor/iterator.rs 96.68% <0.00%> (+0.27%) ⬆️
... and 1 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Gun9niR Gun9niR added user-facing-changes Contains changes that are visible to users component/common Common components, such as array, data chunk, expression. labels Mar 3, 2023
@github-actions github-actions bot removed the user-facing-changes Contains changes that are visible to users label Mar 3, 2023
@BugenZhao BugenZhao changed the title feat(config): warn recongnized field instead of panicing feat(config): warn unrecongnized field instead of panicing Mar 3, 2023
@BugenZhao BugenZhao changed the title feat(config): warn unrecongnized field instead of panicing feat(config): warn unrecongnized field instead of panicking Mar 3, 2023
@Gun9niR Gun9niR mentioned this pull request Mar 3, 2023
9 tasks
Comment on lines +188 to +189
#[serde(flatten)]
pub unrecognized: HashMap<String, Value>,
Copy link
Member

Choose a reason for hiding this comment

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

Very intelligent. 😄 serde-rs/serde#941

@Gun9niR Gun9niR added the mergify/can-merge Indicates that the PR can be added to the merge queue label Mar 6, 2023
@BugenZhao BugenZhao removed the mergify/can-merge Indicates that the PR can be added to the merge queue label Mar 6, 2023
@BugenZhao BugenZhao enabled auto-merge March 6, 2023 07:21
@BugenZhao
Copy link
Member

We're now using the GitHub merge queue. 🥺

@BugenZhao BugenZhao changed the title feat(config): warn unrecongnized field instead of panicking feat(config): warn unrecognized field instead of panicking Mar 6, 2023
@BugenZhao BugenZhao added this pull request to the merge queue Mar 8, 2023
Merged via the queue into main with commit adf2a35 Mar 8, 2023
5 checks passed
@BugenZhao BugenZhao deleted the zhidong/warn-unrecognized-config branch March 8, 2023 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/common Common components, such as array, data chunk, expression. type/feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants