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(storage): introduce non-proto type for vnode bitmap #3030

Merged
merged 9 commits into from
Jun 8, 2022

Conversation

xx01cyx
Copy link
Contributor

@xx01cyx xx01cyx commented Jun 7, 2022

What's changed and what's your intention?

Summarize your change

Introduce non-proto type for vnode bitmap.

Checklist

  • I have written necessary docs and comments
  • I have added necessary unit tests and integration tests
  • All checks passed in ./risedev check (or alias, ./risedev c)

Refer to a related PR or issue link (optional)

#2882 should depend on this PR. More specifically, the non-proto type introduced by this PR will be used in keyspace and interfaces of state store (get, scan, etc.).

@xx01cyx xx01cyx requested review from skyzh and fuyufjh June 7, 2022 07:26
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

license-eye has totally checked 827 files.

Valid Invalid Ignored Fixed
824 2 1 0
Click to see the invalid file list
  • src/common/src/consistent_hash/mod.rs
  • src/common/src/consistent_hash/vnode.rs

src/common/src/consistent_hash/mod.rs Show resolved Hide resolved
src/common/src/consistent_hash/vnode.rs Show resolved Hide resolved
xx01cyx and others added 2 commits June 7, 2022 15:28
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Jun 7, 2022

Codecov Report

Merging #3030 (728f899) into main (109e7d0) will increase coverage by 0.00%.
The diff coverage is 91.02%.

@@           Coverage Diff           @@
##             main    #3030   +/-   ##
=======================================
  Coverage   73.26%   73.26%           
=======================================
  Files         730      731    +1     
  Lines       98392    98441   +49     
=======================================
+ Hits        72082    72122   +40     
- Misses      26310    26319    +9     
Flag Coverage Δ
rust 73.26% <91.02%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
src/common/src/lib.rs 100.00% <ø> (ø)
src/storage/src/hummock/shared_buffer/mod.rs 89.71% <ø> (ø)
src/storage/src/hummock/state_store.rs 78.14% <ø> (ø)
src/common/src/consistent_hash/vnode.rs 90.54% <90.54%> (ø)
src/storage/src/hummock/state_store_tests.rs 79.63% <100.00%> (-0.37%) ⬇️
src/storage/src/hummock/utils.rs 93.18% <100.00%> (-0.09%) ⬇️
src/meta/src/model/barrier.rs 78.57% <0.00%> (-3.58%) ⬇️
src/meta/src/hummock/mock_hummock_meta_client.rs 43.82% <0.00%> (-1.13%) ⬇️
src/storage/src/hummock/local_version_manager.rs 84.12% <0.00%> (-0.16%) ⬇️
src/meta/src/hummock/hummock_manager.rs 86.85% <0.00%> (-0.11%) ⬇️
... and 1 more

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

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

if let Ok(pos) =
bitmaps.binary_search_by_key(&self.table_id, |bitmap| bitmap.get_table_id())
{
let text = &bitmaps[pos];
Copy link
Member

Choose a reason for hiding this comment

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

a small question: why it's called "text"? 👀

Copy link
Contributor Author

@xx01cyx xx01cyx Jun 7, 2022

Choose a reason for hiding this comment

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

Just copied the function from src/storage/src/hummock/utils.rs. 🤣 Weird indeed. Lemme change it.

// table owns.
#[derive(Clone, Default)]
pub struct VNodeBitmap {
table_id: u32,
Copy link
Member

@fuyufjh fuyufjh Jun 7, 2022

Choose a reason for hiding this comment

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

Looks a little strange. Are you sure every VNodeBitmap needs a table_id? The most intuitive representation may be only bitmap inside (e.g. Vec<u8>) of it, while the table_id is out of it (e.g. HashMap<u32, VNodeBitmap > )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There will be a VNodeBitmap in every Keyspace of a state table, so table_id is in need here. Also, VNodeBitmap will be added to the interface of StateStore, where we use it for read pruning. In this case, table_id is also necessary. Any other case to use VNodeBitmap?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And from the aspect of logic, the struct is designed for read pruning, which depends on state table. So having a table_id is reasonable, right? 🤔

Copy link
Member

Choose a reason for hiding this comment

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

Sounds reasonable 😁

@xx01cyx xx01cyx enabled auto-merge (squash) June 8, 2022 01:21
@xx01cyx xx01cyx merged commit 408e9fb into main Jun 8, 2022
@xx01cyx xx01cyx deleted the cyx/non-proto-vnode-bitmap branch June 8, 2022 01:35
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.

2 participants