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): deny unitialized data_directory and state_store #9170

Merged
merged 5 commits into from
Apr 19, 2023

Conversation

Gun9niR
Copy link
Contributor

@Gun9niR Gun9niR commented Apr 13, 2023

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

What's changed and what's your intention?

To support mandatory initialization of a system parameter, developers can specify None as the default value in the params declaration macro (for_all_undeprecated_params). Then we can utilize system_params_to_kv invoked when the cluster is started for the first time to check for uninitialized params.

ALTER SYSTEM SET data_directory/state_store = DEFAULT; will also result in an error (though the semantic is wrong as discussed in #8851):

SystemParams error: data_directory does not have a default value

Closes #9153

Checklist For Contributors

  • I have written necessary rustdoc comments
  • 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

Types of user-facing changes

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

  • Installation and deployment
  • RisingWave cluster configuration changes

Release note

--data_directory and --state_store must be specified on CLI of the meta node, or the cluster will fail to start.

@github-actions github-actions bot added type/feature user-facing-changes Contains changes that are visible to users labels Apr 13, 2023
@Gun9niR Gun9niR marked this pull request as draft April 13, 2023 14:20
@Gun9niR
Copy link
Contributor Author

Gun9niR commented Apr 13, 2023

@huangjw806 We might want to update the docs about system params.

/// Macro input is { field identifier, type, default value }
///
/// Note:
/// - Having `None` as default value means the parameter must be initialized.
macro_rules! for_all_undeprecated_params {
    ($macro:ident
        $(, { $field:ident, $type:ty, $default:expr })*) => {
        $macro! {
            { barrier_interval_ms, u32, Some(1000_u32) },
            { checkpoint_frequency, u64, Some(10_u64) },
            { sstable_size_mb, u32, Some(256_u32) },
            { block_size_kb, u32, Some(64_u32) },
            { bloom_false_positive, f64, Some(0.001_f64) },
            { state_store, String, None },
            { data_directory, String, None },
            { backup_storage_url, String, Some("memory".to_string()) },
            { backup_storage_directory, String, Some("backup".to_string()) },
            { telemetry_enabled, bool, Some(true) },
            $({ $field, $type, $default },)*
        }
    };
}

The third column's value being None means that the corresponding parameter must be specified from CLI.

@Gun9niR Gun9niR requested review from fuyufjh and BugenZhao April 13, 2023 14:44
@Gun9niR Gun9niR marked this pull request as ready for review April 13, 2023 14:45
@codecov
Copy link

codecov bot commented Apr 14, 2023

Codecov Report

Merging #9170 (11debdc) into main (49630b2) will increase coverage by 0.00%.
The diff coverage is 48.88%.

@@           Coverage Diff           @@
##             main    #9170   +/-   ##
=======================================
  Coverage   70.84%   70.84%           
=======================================
  Files        1200     1200           
  Lines      199998   200010   +12     
=======================================
+ Hits       141689   141703   +14     
+ Misses      58309    58307    -2     
Flag Coverage Δ
rust 70.84% <48.88%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
src/cmd_all/src/playground.rs 0.00% <0.00%> (ø)
src/common/src/system_param/local_manager.rs 90.00% <0.00%> (ø)
src/meta/src/lib.rs 0.90% <ø> (ø)
src/risedevtool/src/risectl_env.rs 0.00% <0.00%> (ø)
src/risedevtool/src/task/meta_node_service.rs 0.00% <0.00%> (ø)
src/risedevtool/src/task/utils.rs 0.00% <0.00%> (ø)
src/common/src/config.rs 78.64% <50.00%> (ø)
src/common/src/system_param/mod.rs 88.14% <90.00%> (-0.41%) ⬇️
...c/meta/src/backup_restore/meta_snapshot_builder.rs 87.50% <100.00%> (ø)
src/meta/src/manager/env.rs 69.49% <100.00%> (ø)
... and 1 more

... and 1 file with indirect coverage changes

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

@huangjw806
Copy link
Contributor

@arkbriar Please confirm whether the operator needs to be changed synchronously, thank you!

@Gun9niR Gun9niR requested a review from arkbriar April 14, 2023 04:13
Copy link
Member

@BugenZhao BugenZhao left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@arkbriar arkbriar left a comment

Choose a reason for hiding this comment

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

LGTM

@arkbriar
Copy link
Contributor

Please confirm whether the operator needs to be changed synchronously, thank you!

Sure. AFAIK, the operator should work without any change.

@Gun9niR Gun9niR added this pull request to the merge queue Apr 19, 2023
Merged via the queue into main with commit 75efaa1 Apr 19, 2023
@Gun9niR Gun9niR deleted the zhidong/deny-unitialized-storage-param branch April 19, 2023 07:19
@hengm3467 hengm3467 added the 📖✓ Covered or will be covered in the user docs. label Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change type/feature user-facing-changes Contains changes that are visible to users 📖✓ Covered or will be covered in the user docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Discussion: Should the default data_directory: hummock001 be removed?
6 participants