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: add load_based selector in meta #874

Merged
merged 11 commits into from
Jan 17, 2023

Conversation

fengys1996
Copy link
Contributor

@fengys1996 fengys1996 commented Jan 14, 2023

I hereby agree to the terms of the GreptimeDB CLA

What's changed and what's your intention?

This pr mainly change:

  1. add load_based selector. (Now it is mainly based on the number of regions of the datanode)
  2. add a attrs filed in Context, which used to pass some paramters to Selector.
  3. fix wrong error display.

How to use load_based or lease_based selector? Default lease_based.

cargo run -- metasrv start --selector LoadBased
cargo run -- metasrv start --selector LeaseBased 

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.

Refer to a related PR or issue link (optional)

@fengys1996 fengys1996 marked this pull request as ready for review January 16, 2023 02:31
@codecov
Copy link

codecov bot commented Jan 16, 2023

Codecov Report

Merging #874 (53ceb62) into develop (2664436) will decrease coverage by 0.09%.
The diff coverage is 85.15%.

@@             Coverage Diff             @@
##           develop     #874      +/-   ##
===========================================
- Coverage    86.28%   86.19%   -0.10%     
===========================================
  Files          425      427       +2     
  Lines        55858    57260    +1402     
===========================================
+ Hits         48199    49353    +1154     
- Misses        7659     7907     +248     
Flag Coverage Δ
rust 86.19% <85.15%> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/cmd/src/error.rs 91.78% <0.00%> (-1.28%) ⬇️
src/meta-srv/src/bootstrap.rs 0.00% <0.00%> (ø)
src/meta-srv/src/error.rs 95.32% <ø> (ø)
src/meta-srv/src/handler.rs 100.00% <ø> (ø)
src/meta-srv/src/selector/load_based.rs 77.69% <77.69%> (ø)
src/meta-srv/src/selector.rs 85.29% <85.29%> (ø)
src/cmd/src/metasrv.rs 70.51% <90.90%> (+3.34%) ⬆️
src/meta-srv/src/handler/node_stat.rs 77.94% <95.23%> (-0.19%) ⬇️
src/meta-srv/src/keys.rs 98.12% <97.82%> (+0.42%) ⬆️
src/meta-srv/src/handler/persist_stats_handler.rs 97.53% <100.00%> (+0.09%) ⬆️
... and 51 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@sunng87
Copy link
Member

sunng87 commented Jan 16, 2023

  1. it looks like this patch does not contain usage of LoadBasedSelector so I guess this is part 1 with some more patches following up/
  2. I suggest to avoid using AnyMap when it's possible because of it's opaque at compile time. For context, we can include as much information as needed.

src/meta-srv/src/metasrv.rs Outdated Show resolved Hide resolved
src/meta-srv/src/keys.rs Outdated Show resolved Hide resolved
config/metasrv.example.toml Outdated Show resolved Hide resolved
src/meta-srv/src/handler/node_stat.rs Outdated Show resolved Hide resolved
src/meta-srv/src/keys.rs Show resolved Hide resolved
@MichaelScofield MichaelScofield merged commit 6f5639f into GreptimeTeam:develop Jan 17, 2023
@fengys1996 fengys1996 deleted the refactor/meta branch February 16, 2023 09:32
paomian pushed a commit to paomian/greptimedb that referenced this pull request Oct 19, 2023
* fix: wrong error info

* add derive hash for StatKey

* add a attrs field in Context

* add load_based selector

* add license

* make Nodestat module public

* add meta startup config item about selector

* cr: remove attrs, add concrete type in context

* cr: change region_number type to Option<u64>

* cr: add comment in example.toml

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

Successfully merging this pull request may close these issues.

3 participants