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(cmd_all): support override args for each node #15044

Closed
wants to merge 13 commits into from

Conversation

kwannoel
Copy link
Contributor

@kwannoel kwannoel commented Feb 7, 2024

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 and standalone mode.

Subsequent PRs will also include profiles.

Related: #14997

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added test labels as necessary. See details.
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

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.

src/cmd_all/src/single_node.rs Outdated Show resolved Hide resolved
// 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);
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

@kwannoel kwannoel Feb 7, 2024

Choose a reason for hiding this comment

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

fn default_frontend_opts() -> FrontendOpts {

The defaults I'm referring to are here.

Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added it: 62c2310

Copy link
Contributor Author

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",

Copy link
Member

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.

Copy link
Contributor Author

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,
Copy link
Contributor Author

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",
Copy link
Contributor Author

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(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Data directory also overridden

Comment on lines +89 to +104

/// 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>,
Copy link
Member

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

Copy link
Contributor Author

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",
Copy link
Contributor Author

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.

Comment on lines +376 to +397
--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
Copy link
Member

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=?

Copy link
Member

@fuyufjh fuyufjh Feb 19, 2024

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 😄

Copy link
Member

@xxchan xxchan 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 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);
Copy link
Member

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/?
Copy link
Member

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.

@kwannoel kwannoel force-pushed the kwannoel/provide-extra-opts branch from 62c2310 to 0142bdc Compare March 6, 2024 08:53
@kwannoel kwannoel closed this Mar 11, 2024
@kwannoel
Copy link
Contributor Author

Look at #15577 instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants