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(meta): introduce consistent hash logic #626

Merged
merged 7 commits into from
Mar 3, 2022
Merged

Conversation

xx01cyx
Copy link
Contributor

@xx01cyx xx01cyx commented Mar 2, 2022

What's changed and what's your intention?

PLEASE DO NOT LEAVE THIS EMPTY !!!

Please explain IN DETAIL what the changes are in this PR and why they are needed:

  • Summarize your change (mandatory)

    • Introduce consistent hash logic (altering mapping when a node enters or leaves the cluster)
    • Introduce ParallelUnit for each ComputeNode
  • How does this PR work? Need a brief introduction for the changed logic (optional)

  • Describe clearly one logical change and avoid lazy messages (optional)

  • Describe any limitations of the current code (optional)

Checklist

  • I have written necessary docs and comments
  • I have added necessary unit tests and integration tests

Refer to a related PR or issue link (optional)

#381

@fuyufjh fuyufjh marked this pull request as draft March 2, 2022 04:47
proto/common.proto Outdated Show resolved Hide resolved
Copy link
Member

@fuyufjh fuyufjh left a comment

Choose a reason for hiding this comment

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

Good job!

rust/meta/src/manager/hash_dispatch.rs Show resolved Hide resolved
rust/meta/src/model/hash_mapping.rs Show resolved Hide resolved
/// Mapping from parallel unit to virtual key, which is volatile.
owner_mapping: HashMap<ParallelUnitId, Vec<VirtualKey>>,
/// Mapping from key count to parallel unit, aiming to maintain load balance.
load_balancer: BTreeMap<usize, Vec<ParallelUnitId>>,
Copy link
Member

@fuyufjh fuyufjh Mar 2, 2022

Choose a reason for hiding this comment

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

I think it's okay to recalculate the load everytime on add/delete node instead of maintaining such a map, which may simplify the implementation.

rust/meta/src/model/hash_mapping.rs Show resolved Hide resolved
rust/meta/src/manager/hash_dispatch.rs Outdated Show resolved Hide resolved
@xx01cyx xx01cyx linked an issue Mar 2, 2022 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Mar 2, 2022

Codecov Report

Merging #626 (49a3df9) into main (c49c9aa) will increase coverage by 0.07%.
The diff coverage is 85.61%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #626      +/-   ##
============================================
+ Coverage     71.35%   71.43%   +0.07%     
  Complexity     2699     2699              
============================================
  Files           891      893       +2     
  Lines         50657    50935     +278     
  Branches       1723     1723              
============================================
+ Hits          36146    36384     +238     
- Misses        13699    13739      +40     
  Partials        812      812              
Flag Coverage Δ
java 60.06% <ø> (ø)
rust 76.34% <85.61%> (+0.07%) ⬆️

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

Impacted Files Coverage Δ
rust/meta/src/model/mod.rs 76.31% <ø> (ø)
rust/meta/src/cluster/mod.rs 59.43% <50.00%> (-2.77%) ⬇️
rust/meta/src/model/hash_mapping.rs 88.00% <88.00%> (ø)
rust/meta/src/manager/hash_dispatch.rs 89.09% <89.09%> (ø)
rust/frontend/src/scheduler/plan_fragmenter.rs 98.56% <100.00%> (+0.03%) ⬆️
rust/meta/src/manager/id.rs 91.37% <100.00%> (+0.15%) ⬆️
rust/meta/src/model/cluster.rs 83.33% <100.00%> (+3.33%) ⬆️
rust/meta/src/hummock/compaction.rs 67.32% <0.00%> (-0.66%) ⬇️
rust/frontend/src/planner/mod.rs 100.00% <0.00%> (ø)
rust/frontend/src/planner/select.rs 66.66% <0.00%> (ø)
... and 34 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c49c9aa...49a3df9. Read the comment docs.

Copy link
Member

@fuyufjh fuyufjh 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.

rust/meta/src/manager/hash_dispatch.rs Outdated Show resolved Hide resolved
@fuyufjh
Copy link
Member

fuyufjh commented Mar 2, 2022

Please feel free to click the "Ready for review" button to make it able to merge

@yezizp2012 yezizp2012 marked this pull request as ready for review March 3, 2022 03:49
@xx01cyx xx01cyx merged commit 3a8ef88 into main Mar 3, 2022
@xx01cyx xx01cyx deleted the feat/consistent-hash branch March 3, 2022 04:14
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.

streaming: consistant hash in dispatch operator
3 participants