-
Notifications
You must be signed in to change notification settings - Fork 594
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(cmd_all): support override args for each node #15044
Conversation
// This hack is required, because `update_from` treats arg[0] as the command name. | ||
let prefix = "".to_string(); | ||
let extra_opts = iter::once(&prefix).chain(extra_opts.iter()); | ||
opts.update_from(extra_opts); |
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.
According to my tests, this will also overwrite all the fields with default values, if present. Will this be a problem if we're going to provide some non-default value from the profile?
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.
Hmm what do you mean?
single_node
provides some defaults, seems like that's still preserved:
https://github.com/risingwavelabs/risingwave/pull/15044/files#r1481228711
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.
risingwave/src/cmd_all/src/single_node.rs
Line 187 in 482ded4
fn default_frontend_opts() -> FrontendOpts { |
The defaults I'm referring to are here.
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.
By "default value" I'm not referring to fn default_xx_opts
, but the fields attributed with #[clap(default_value = "..")]
.
Would you mind trying...
--meta-addr 127.0.0.1:8888
--meta-extra-opts=--advertise-addr 127.0.0.1:9999
to see if 8888
gets preserved?
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.
Oh in this case I expect it to be overridden.
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'm not sure whether I have made clear, but here I intentionally overwrite the advertise address instead of the listen address. They are different options.
To make it more clear, you can try passing an empty string as the extra options. The 8888
could still be overwritten. Is this also expected?
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.
Added it: 62c2310
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.
Oh yeah you're right... 8888 is not preserved in the listen-addr
:
listen_addr: "127.0.0.1:5690",
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 guess this PR is blocked here now.
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.
Yes. I don't have any other ideas for now. Probably have to make a PR to clap to try and make a case for this.
Otherwise, I think we have to generate a node options builder per node, and use that to update the base options per node.
privatelink_endpoint_default_tags: None, | ||
config_path: "", | ||
backend: Some( | ||
Sql, |
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 initial options we provided with Sql
backend is preserved and not overridden from providing meta opts.
vpc_id: None, | ||
security_group_id: None, | ||
listen_addr: "127.0.0.1:5690", | ||
advertise_addr: "127.0.0.1:9999", |
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.
Advertise address is overridden as expected.
state_store: Some( | ||
"hummock+fs:///root/.risingwave/state_store", | ||
), | ||
data_directory: Some( |
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.
Data directory also overridden
|
||
/// Extra options for meta node. | ||
#[clap(long, env = "RW_SINGLE_NODE_META_EXTRA_OPTS")] | ||
meta_extra_opts: Option<String>, | ||
|
||
/// Extra options for compute node. | ||
#[clap(long, env = "RW_SINGLE_NODE_COMPUTE_EXTRA_OPTS")] | ||
compute_extra_opts: Option<String>, | ||
|
||
/// Extra options for frontend node. | ||
#[clap(long, env = "RW_SINGLE_NODE_FRONTEND_EXTRA_OPTS")] | ||
frontend_extra_opts: Option<String>, | ||
|
||
/// Extra options for compactor node. | ||
#[clap(long, env = "RW_SINGLE_NODE_COMPACTOR_EXTRA_OPTS")] | ||
compactor_extra_opts: Option<String>, |
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.
So we are adding standalone
style opts to single_node
mode now. This makes me think what about adding single_node
style map_opts
to standalone
mode.. #14997 (comment)
(Just random thoughts. Both are OK to me though
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 will deprecate standalone
mode eventually, as per #14997
), | ||
frontend_opts: Some( | ||
FrontendOpts { | ||
listen_addr: "0.0.0.0:4566", |
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.
Default value we specified in src/frontend/src/lib.rs
is 127.0.0.1:4566
.
But in standalone mode, we specify 0.0.0.0:4566
. So the node level defaults do not override as well.
--meta-extra-opts=--advertise-addr 127.0.0.1:9999 --data-directory \"some path with spaces\" \ | ||
--state-store hummock+fs:///root/.risingwave/state_store \ | ||
--sql-endpoint sqlite:///root/.risingwave/meta_store/single_node.db?mode=rwc | ||
--compute-extra-opts=--listen-addr 127.0.0.1:8888 --total-memory-bytes 123 --parallelism 10 |
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.
Is this correct? Shouldn't we quote the value of --meta-extra-opts=
?
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 have seen this before. Also curious why it works 😄
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.
Generally LGTM if we make sure the details are correct. Cool!
// This hack is required, because `update_from` treats arg[0] as the command name. | ||
let prefix = "".to_string(); | ||
let extra_opts = iter::once(&prefix).chain(extra_opts.iter()); | ||
opts.update_from(extra_opts); |
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 guess this PR is blocked here now.
@@ -53,6 +56,8 @@ pub static DEFAULT_SINGLE_NODE_STATE_STORE_URL: LazyLock<String> = LazyLock::new | |||
about = "[default] The Single Node mode. Start all services in one process, with process-level options. This will be executed if no subcommand is specified" | |||
)] | |||
/// Here we define our own defaults for the single node mode. | |||
// TODO(kwannoel): Support user supplied profiles. | |||
// Perhaps https://docs.rs/clap-serde-derive/0.2.1/clap_serde_derive/? |
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 think it's not that necessary. We have lots of configurations in YAML, and they are categorized into storage, compute, server, etc. to make it readable, but we don't want all of them to be settable from CLI.
Co-authored-by: Bugen Zhao <[email protected]>
62c2310
to
0142bdc
Compare
Look at #15577 instead. |
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
Also decouple
single_node
andstandalone
mode.Subsequent PRs will also include
profiles
.Related: #14997
Checklist
./risedev check
(or alias,./risedev c
)Documentation
Release note
If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.