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

refactor join cluster process #4219

Merged
merged 3 commits into from Feb 23, 2022
Merged

Conversation

lichuang
Copy link
Collaborator

I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/

Summary

  1. join cluster after start all service, this can make K8S readiness probe happy, thus the node host name can be resolved by DNS.
  2. use node id as node name in add_node,instead of an empty string.

Changelog

  • Bug Fix

Related Issues

Fixes 4218

Test Plan

Unit Tests

Stateless Tests

@vercel
Copy link

vercel bot commented Feb 22, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/databend/databend/EHMxJnmtTaQDE374iZYXrgapBeDa
✅ Preview: https://databend-git-fork-lichuang-lichuangrefactor-databend.vercel.app

@mergify
Copy link
Contributor

mergify bot commented Feb 22, 2022

Thanks for the contribution!
I have applied any labels matching special text in your PR Changelog.

Please review the labels and make any necessary changes.

@mergify mergify bot added the pr-bugfix this PR patches a bug in codebase label Feb 22, 2022
@lichuang lichuang marked this pull request as ready for review February 22, 2022 12:48
@@ -412,6 +412,47 @@ impl MetaNode {
Ok(mn)
}

pub async fn join_cluster(&self, conf: &RaftConfig) -> MetaResult<()> {
if conf.join.is_empty() {
return Ok(());
Copy link
Member

Choose a reason for hiding this comment

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

Should we log a warning message when this config is empty?

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 the elaborated name of this method should be try_to_join_cluster_if_cli_arg_join_is_specified().

conf.join being empty means the user did not pass --join arguments to metasrv. It's totally OK.

let addrs = &conf.join;
// Join cluster use advertise host instead of listen host
let raft_api_advertise_host_endpoint = conf.raft_api_advertise_host_endpoint();
#[allow(clippy::never_loop)]
Copy link
Member

Choose a reason for hiding this comment

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

Why not just use addrs[0] ?

Copy link
Member

Choose a reason for hiding this comment

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

It's an unfinished code snippet... There should be a retry loop... :((

Copy link
Member

@drmingdrmer drmingdrmer left a comment

Choose a reason for hiding this comment

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

Looks pretty good to me:DDD

Copy link
Collaborator

@ZhiHanZ ZhiHanZ left a comment

Choose a reason for hiding this comment

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

tested and works, thanks @lichuang

Copy link
Member

@BohuTANG BohuTANG left a comment

Choose a reason for hiding this comment

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

@mergify mergify bot merged commit 353dc8d into datafuselabs:main Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-review pr-bugfix this PR patches a bug in codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: In K8S,if meta node use K8S pod host name as advertize host, the meta cannot join a cluster success.
6 participants