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: use SHOW PARAMETERS to list all system parameters #7882

Merged
merged 13 commits into from
Feb 14, 2023

Conversation

Gun9niR
Copy link
Contributor

@Gun9niR Gun9niR commented Feb 13, 2023

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

What's changed and what's your intention?

As title. Also refactored the code with macro to reduce the occurrence of hard coded keys such as CHECKPOINT_FREQUENCY_KEY.

dev=> show parameters;
           Name           |    Value    
--------------------------+-------------
 barrier_interval_ms      | 1000
 checkpoint_interval      | 10
 sstable_size_mb          | 256
 block_size_kb            | 64
 bloom_false_positive     | 0.001
 state_store              | 
 data_directory           | hummock_001
 backup_storage_url       | memory
 backup_storage_directory | backup

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • 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)

Documentation

Click here for Documentation

Types of user-facing changes

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

  • SQL commands, functions, and operators

Release note

Use SHOW PARAMETERS; to show all system parameters.

@Gun9niR Gun9niR marked this pull request as draft February 13, 2023 11:13
@Gun9niR Gun9niR changed the title feat: SHOW PARAMETERS feat: use SHOW PARAMETERS to see all system parameters Feb 13, 2023
@Gun9niR Gun9niR added the user-facing-changes Contains changes that are visible to users label Feb 13, 2023
@Gun9niR Gun9niR requested review from fuyufjh and BugenZhao February 13, 2023 12:30
@Gun9niR Gun9niR marked this pull request as ready for review February 13, 2023 12:30
@Gun9niR Gun9niR changed the title feat: use SHOW PARAMETERS to see all system parameters feat: use SHOW PARAMETERS to list all system parameters Feb 13, 2023
Copy link
Member

@fuyufjh fuyufjh left a comment

Choose a reason for hiding this comment

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

Generally LGTM

src/common/src/system_param.rs Outdated Show resolved Hide resolved
async fn insert<S>(&self, store: &S) -> MetadataModelResult<()>
where
S: MetaStore,
{
let mut txn = Transaction::default();
self.barrier_interval_ms.inspect(|v| {
Copy link
Member

Choose a reason for hiding this comment

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

Good job!

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

src/common/src/system_param.rs Outdated Show resolved Hide resolved
@Gun9niR Gun9niR force-pushed the zhidong/show-params branch from 83c4d48 to 2ac54df Compare February 14, 2023 07:29
@codecov
Copy link

codecov bot commented Feb 14, 2023

Codecov Report

Merging #7882 (76d08bc) into main (680bc23) will increase coverage by 0.02%.
The diff coverage is 39.76%.

@@            Coverage Diff             @@
##             main    #7882      +/-   ##
==========================================
+ Coverage   71.78%   71.80%   +0.02%     
==========================================
  Files        1114     1116       +2     
  Lines      178474   178506      +32     
==========================================
+ Hits       128115   128185      +70     
+ Misses      50359    50321      -38     
Flag Coverage Δ
rust 71.80% <39.76%> (+0.02%) ⬆️

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

Impacted Files Coverage Δ
src/common/src/error.rs 71.64% <ø> (+1.09%) ⬆️
src/common/src/lib.rs 100.00% <ø> (ø)
src/frontend/src/handler/mod.rs 61.11% <0.00%> (ø)
src/frontend/src/handler/variable.rs 17.50% <0.00%> (-8.11%) ⬇️
src/frontend/src/meta_client.rs 0.00% <0.00%> (ø)
src/frontend/src/test_utils.rs 83.39% <0.00%> (-0.45%) ⬇️
src/meta/src/manager/system_param/mod.rs 0.00% <ø> (ø)
src/meta/src/manager/system_param/model.rs 0.00% <0.00%> (ø)
src/meta/src/rpc/server.rs 0.00% <0.00%> (ø)
src/meta/src/rpc/service/cluster_service.rs 0.00% <0.00%> (ø)
... and 13 more

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

@mergify mergify bot merged commit 7724305 into main Feb 14, 2023
@mergify mergify bot deleted the zhidong/show-params branch February 14, 2023 10:25
@Gun9niR Gun9niR mentioned this pull request Feb 15, 2023
9 tasks
@hengm3467
Copy link
Contributor

@Gun9niR @fuyufjh I'm wondering if we have the definitions of these parameters (and how to use) documented somewhere? This one should be documented together with ALTER SYSTEM. I need a bit more info than just the command and the parameter names :)
I see we have an internal document about system parameters, but there are no value ranges. https://www.notion.so/risingwave-labs/System-Parameters-b9b9c00308bc4020a4208fa1764b24db?pvs=4

Thanks a lot!

@fuyufjh
Copy link
Member

fuyufjh commented Feb 21, 2023

@Gun9niR @fuyufjh I'm wondering if we have the definitions of these parameters (and how to use) documented somewhere? This one should be documented together with ALTER SYSTEM. I need a bit more info than just the command and the parameter names :) I see we have an internal document about system parameters, but there are no value ranges. https://www.notion.so/risingwave-labs/System-Parameters-b9b9c00308bc4020a4208fa1764b24db?pvs=4

Thanks a lot!

@hengm3467 Please check system_param.rs for the source of truth. (You might need to switch to the correct branch other than main)

It's worth mentioning that

// Define check rules when a field is changed. By default all fields are immutable.
// If you want custom rules, please override the default implementation in
// `OverrideValidateOnSet` below.

So a param is either immutable or has a validation range defined there.

@Gun9niR
Copy link
Contributor Author

Gun9niR commented Feb 21, 2023

@hengm3467 You can check for_all_undeprecated_params macro definition for a full list of params in the latest release (deprecated params will be hidden from SQL interface).

For value range/mutability, you can check OverrideValidateOnSet implementation. The absence of the function with a particular field name indicates that it is immutable.

const SYSTEM_PARAM_CF_NAME: &str = "cf/system_params";

const BARRIER_INTERVAL_MS_KEY: &str = "barrier_interval_ms";
const CHECKPOINT_FREQUENCY_KEY: &str = "checkpoint_interval";
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@Gun9niR Gun9niR Jun 29, 2023

Choose a reason for hiding this comment

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

These hard-coded constants were only used for a few commits before I refactored the code to use macro to generate these keys (const CHECKPOINT_FREQUENCY_KEY: &str = "checkpoint_interval"; seems to be a mistake here). The key in etcd has been checkpoint_frequency since this commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature user-facing-changes Contains changes that are visible to users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants