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: add etcd_connect_options for metasrv #3853

Closed

Conversation

zyy17
Copy link
Collaborator

@zyy17 zyy17 commented May 2, 2024

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

What's changed and what's your intention?

The original create_etcd_client() uses None for ConnectOptions and can't configure some important arguments for connecting etcd.

In this PR, I created the EtcdConnectOptions, a subset of ConnectOptions, in the MetasrvOptions. I also added the covert function to let EtcdConnectOptions convert ConnectOptions easily.

btw, it's convenient to add TLS configurations in the future in the same structure(I will add it in the next PR).

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR does not require documentation updates.

@zyy17 zyy17 requested review from MichaelScofield and a team as code owners May 2, 2024 10:39
@github-actions github-actions bot added the docs-not-required This change does not impact docs. label May 2, 2024
@zyy17 zyy17 force-pushed the refactor/add-etcd-connect-options branch from 6b7d230 to a272f06 Compare May 2, 2024 10:41

/// The etcd connect options.
/// Most of the options are from `etcd_client::ConnectOptions`.
pub etcd_connect_options: EtcdConnectOptions,
Copy link
Contributor

Choose a reason for hiding this comment

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

This option itself can be Option? Or we define a etcd subsection for metasrv. Extending this option looks like we leak/couple the metasrv with etcd implementation.

Copy link
Collaborator Author

@zyy17 zyy17 May 3, 2024

Choose a reason for hiding this comment

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

It seems reasonable. It also reminds me that there is more than one option for metasrv backend storage in the future(file system, memory, etcd, ...). I think we need the BackendStorageProvider and etcd is one of the providers.

For example:

[storage]
type = "etcd"
addr = "127.0.0.1:2379"
timeout = "5s"

What do you think? @fengjiachun

Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems reasonable. It also reminds me that there is more than one option for metasrv backend storage in the future(file system, memory, etcd, ...). I think we need the BackendStorageProvider and etcd is one of the providers.

For example:

[storage]
type = "etcd"
addr = "127.0.0.1:2379"
timeout = "5s"

What do you think? @fengjiachun

+1

Copy link

codecov bot commented May 2, 2024

Codecov Report

Attention: Patch coverage is 10.52632% with 17 lines in your changes are missing coverage. Please review.

Project coverage is 85.28%. Comparing base (2748cec) to head (69dec61).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3853      +/-   ##
==========================================
- Coverage   85.60%   85.28%   -0.33%     
==========================================
  Files         955      955              
  Lines      163262   163278      +16     
==========================================
- Hits       139764   139245     -519     
- Misses      23498    24033     +535     

@zyy17 zyy17 force-pushed the refactor/add-etcd-connect-options branch from a272f06 to cdc6a25 Compare May 3, 2024 08:30
@zyy17 zyy17 force-pushed the refactor/add-etcd-connect-options branch from cdc6a25 to 69dec61 Compare May 3, 2024 08:49
@zyy17
Copy link
Collaborator Author

zyy17 commented May 6, 2024

Let me refactor again for adding the BackendStorageProvider.

@zyy17 zyy17 marked this pull request as draft May 7, 2024 11:17
@zyy17
Copy link
Collaborator Author

zyy17 commented May 27, 2024

Close it temporarily. I will re-open it when the PR is ready for review.

@zyy17 zyy17 closed this May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-not-required This change does not impact docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants