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: introduce the region role #2640

Merged
merged 2 commits into from
Oct 31, 2023

Conversation

WenyXu
Copy link
Member

@WenyXu WenyXu commented Oct 23, 2023

I hereby agree to the terms of the GreptimeDB CLA

What's changed and what's your intention?

Introduce the region's role. Now, we only have two role:

The RegionRole::Follower: Readonly Region(mito2), Readonly Region(file).
The RegionRole::Leader: Writable Region(mito2).

Notes: We treat all File Region as RegionRole::Follower, even if it's the leader peer in the region routes.

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)

#2639

@codecov
Copy link

codecov bot commented Oct 23, 2023

Codecov Report

Merging #2640 (be4a115) into develop (88eb695) will decrease coverage by 0.41%.
The diff coverage is 41.50%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2640      +/-   ##
===========================================
- Coverage    85.01%   84.61%   -0.41%     
===========================================
  Files          739      740       +1     
  Lines       120141   120181      +40     
===========================================
- Hits        102137   101690     -447     
- Misses       18004    18491     +487     

src/datanode/src/region_server.rs Outdated Show resolved Hide resolved
src/file-engine/src/engine.rs Outdated Show resolved Hide resolved
src/file-engine/src/engine.rs Show resolved Hide resolved
@waynexia
Copy link
Member

waynexia commented Oct 27, 2023

Notes: We treat all File Region as RegionRole::Follower, even if it's the leader peer in the region routes.

From this point, how about defining region's role in a group of permission? Something like POSIX permission (but they have many differences). E.g.:

  • Can a region write to object store
  • Can a region write to WAL
  • Can a region read WAL
  • Can a region read object store
  • ...

By doing this, we don't need to add extra conditions for file regions. And it's more flexible and straightforward. Like, to reduce WAL subscribe workload, we can have a region that only fetches data from S3 but is not aware of the newest WAL change. As well as the compactor only needs read/write permission to object-store (and update manifest, but this might need WAL write permission in the future). And this is closer to the underlying engine's permission implementation.

@WenyXu
Copy link
Member Author

WenyXu commented Oct 31, 2023

@MichaelScofield @fengjiachun PTAL

Copy link
Collaborator

@fengjiachun fengjiachun left a comment

Choose a reason for hiding this comment

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

LGTM

@fengjiachun
Copy link
Collaborator

Notes: We treat all File Region as RegionRole::Follower, even if it's the leader peer in the region routes.

From this point, how about defining region's role in a group of permission? Something like POSIX permission (but they have many differences). E.g.:

  • Can a region write to object store
  • Can a region write to WAL
  • Can a region read WAL
  • Can a region read object store
  • ...

By doing this, we don't need to add extra conditions for file regions. And it's more flexible and straightforward. Like, to reduce WAL subscribe workload, we can have a region that only fetches data from S3 but is not aware of the newest WAL change. As well as the compactor only needs read/write permission to object-store (and update manifest, but this might need WAL write permission in the future). And this is closer to the underlying engine's permission implementation.

This looks good, but we still need two completely separate roles to help metasrv easy to make better scheduling.

@fengjiachun fengjiachun added this pull request to the merge queue Oct 31, 2023
Merged via the queue into GreptimeTeam:develop with commit 54ed752 Oct 31, 2023
12 checks passed
@WenyXu WenyXu mentioned this pull request Nov 6, 2023
39 tasks
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.

5 participants