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 provides the ability to distribute lock #961

Merged
merged 3 commits into from
Feb 13, 2023

Conversation

fengys1996
Copy link
Contributor

@fengys1996 fengys1996 commented Feb 8, 2023

I hereby agree to the terms of the GreptimeDB CLA

What's changed and what's your intention?

This pr provides the ability to distribute locks.

Main change:

  1. metasrv add a Lock grpc service.
  2. metasrv add a Lock trait and EtcdLock implement.
  3. meta client provides an API for distributed locks.
  4. an example is provided to show how to use distributed locks.

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 force-pushed the feat/meta/lock branch 2 times, most recently from 91bb881 to 5fa7978 Compare February 9, 2023 08:46
@fengys1996 fengys1996 marked this pull request as ready for review February 10, 2023 03:35
@codecov
Copy link

codecov bot commented Feb 10, 2023

Codecov Report

Merging #961 (a416065) into develop (83ac659) will decrease coverage by 0.28%.
The diff coverage is 47.45%.

@@             Coverage Diff             @@
##           develop     #961      +/-   ##
===========================================
- Coverage    85.90%   85.62%   -0.28%     
===========================================
  Files          456      461       +5     
  Lines        61684    62932    +1248     
===========================================
+ Hits         52987    53886     +899     
- Misses        8697     9046     +349     
Flag Coverage Δ
rust 85.62% <47.45%> (-0.28%) ⬇️

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

Impacted Files Coverage Δ
src/meta-client/src/rpc.rs 95.95% <ø> (ø)
src/meta-srv/src/bootstrap.rs 0.00% <0.00%> (ø)
src/meta-srv/src/election/etcd.rs 0.00% <0.00%> (ø)
src/meta-srv/src/error.rs 93.60% <ø> (+0.58%) ⬆️
src/meta-srv/src/lib.rs 100.00% <ø> (ø)
src/meta-srv/src/lock/etcd.rs 0.00% <0.00%> (ø)
src/meta-srv/src/metasrv.rs 59.57% <0.00%> (-1.97%) ⬇️
src/meta-srv/src/service/lock.rs 0.00% <0.00%> (ø)
src/meta-srv/src/service/store/etcd.rs 50.00% <0.00%> (-0.38%) ⬇️
src/meta-client/src/client.rs 94.61% <25.00%> (-3.46%) ⬇️
... and 31 more

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

src/api/build.rs Outdated Show resolved Hide resolved
src/api/greptime/v1/meta/lock.proto Outdated Show resolved Hide resolved
src/meta-client/src/client.rs Outdated Show resolved Hide resolved
src/meta-srv/src/lock.rs Outdated Show resolved Hide resolved
src/meta-srv/src/lock.rs Outdated Show resolved Hide resolved
wip

impl lock grpc service for meta-srv

reuse the etcd client instead of repeatedly creating etcd client

add some docs and comments

add some comment

meta client support distribute lock

fix: dead lock

self-cr
@fengys1996
Copy link
Contributor Author

PTAL @killme2008 @MichaelScofield

Copy link
Contributor

@killme2008 killme2008 left a comment

Choose a reason for hiding this comment

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

LGTM

@killme2008 killme2008 merged commit c1a9f84 into GreptimeTeam:develop Feb 13, 2023
@fengys1996 fengys1996 deleted the feat/meta/lock branch February 16, 2023 14:47
paomian pushed a commit to paomian/greptimedb that referenced this pull request Oct 19, 2023
* add DistLock trait and a implement based etcd

wip

impl lock grpc service for meta-srv

reuse the etcd client instead of repeatedly creating etcd client

add some docs and comments

add some comment

meta client support distribute lock

fix: dead lock

self-cr

* cr

* rename "expire" -> "expire_secs"
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