-
Notifications
You must be signed in to change notification settings - Fork 333
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: supports auto as default value for some mito configs #4513
Conversation
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4513 +/- ##
==========================================
- Coverage 85.00% 84.74% -0.27%
==========================================
Files 1084 1085 +1
Lines 193935 193996 +61
==========================================
- Hits 164859 164404 -455
- Misses 29076 29592 +516 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "auto" option may not be the best solution. We might need to find a way to support the example config more properly.
#[allow(clippy::from_over_into)] | ||
impl Into<FrontendOptions> for StandaloneOptions { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not implement From<StandaloneOptions> for FrontendOptions
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because StandaloneOptions
is only defined in cmd
, I don't want to make frontend
depend on cmd
.
## The runtime options. | ||
[runtime] | ||
## The number of threads to execute the runtime for global read operations. | ||
global_rt_size = 8 | ||
## The number of threads to execute the runtime for global write operations. | ||
compact_rt_size = 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zyy17 Maybe toml2docs can provide a special marker so that we can comment out some options. e.g.
## The runtime options. | |
[runtime] | |
## The number of threads to execute the runtime for global read operations. | |
global_rt_size = 8 | |
## The number of threads to execute the runtime for global write operations. | |
compact_rt_size = 4 | |
## toml2docs:example-start | |
## The runtime options. | |
## [runtime] | |
## ## The number of threads to execute the runtime for global read operations. | |
## global_rt_size = 8 | |
## ## The number of threads to execute the runtime for global write operations. | |
## compact_rt_size = 4 | |
## toml2docs:example-end |
We can also choose a special marker like ###
, ##!
.
##! global_rt_size = 8
##! example_option = "test"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeap, it's one of the solution that I'm plan to do.
define_mem_size_enum!( | ||
/// Global write buffer size threshold to trigger flush. | ||
GlobalWriteBufferSize, GLOBAL_WRITE_BUFFER_SIZE_FACTOR, ReadableSize::gb(1), Some(ReadableSize::gb(1))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to support unlimited size for all options? Also, if we decouple the example config from the default value, we can use the auto
value by not specifying this option in the TOML. Then we can still use ReadableSize
.
Also, there is an issue with the mem size enum: We can't precompute the size while the enum is Auto
. We need to compute the size each time we call as_bytes()
.
We may also have some options that we want to disable by default and can't get the default value automatically.
Maybe a better way is to support our requirements in https://github.com/zyy17/toml2docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we could remove the unlimited
, what do you think? @zhongzc .
We can't precompute the size while the enum is Auto. We need to compute the size each time we call as_bytes().
Yes, but I think that is good. We don't call it many times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to define a new type for each size just because we need a different default value. At least we can define a function for each default value and provide a method for get_or_default()
.
enum AutoReadableSize {}
let size = AutoReadableSize::Auto;
let x = size.get_or_default(default_global_write_buffer_size);
unlimited
is useful for threshold. Maybe we can define another type like AutoReadableSize
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Nice refactoring.
@@ -561,7 +568,7 @@ impl StartCommand { | |||
|
|||
let (tx, _rx) = broadcast::channel(1); | |||
|
|||
let servers = Services::new(fe_opts, Arc::new(frontend.clone()), plugins) | |||
let servers = Services::new(opts, Arc::new(frontend.clone()), plugins) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-blocking: We also can remove the clone of fe_opts
in L543.
Why is it not a good solution? IMO, taking |
Mentioned in #4513 (comment) We also have to define a new type for each size in this way, just because we need a different default value. @zyy17 |
I hereby agree to the terms of the GreptimeDB CLA.
Refer to a related PR or issue link (optional)
#4497
What's changed and what's your intention?
Main changes:
define_mem_size_enum
to define an enum type, which supportsauto
,unlimited
, andReadableSize
. When it'sauto
, its value is determined by system memory size, factor, and maximum size.define_mem_size_enum
to defineglobal_buffer_size
,page_cache_size
etc./config
HTTP API returning the wrong value in standalone mode.auto
, make/config
to return the actual value.information_schema
is read-only currently, updatedexport_metrics.self_import.db
togreptime_metrics
.http
configs to the datanode sample config file.Checklist