feat: Implement lock component for ProcedureManager#937
feat: Implement lock component for ProcedureManager#937evenyag merged 5 commits intoGreptimeTeam:developfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #937 +/- ##
===========================================
+ Coverage 85.85% 85.95% +0.09%
===========================================
Files 441 443 +2
Lines 59053 59202 +149
===========================================
+ Hits 50700 50885 +185
+ Misses 8353 8317 -36
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
|
Seems the lock implementation has some complex mechanism, specifically how the locks are propagated from parents to children. Not found in RFC. Can you give a more thorough explanation behind the design choice? |
See the locking part
But this PR doesn't implement this. We use this to avoid recursive locking. |
|
You could refer to the PoC for the full prototype. |
87a0809 to
2811f4c
Compare
* feat: Add procedure meta * feat: Implement lock for procedures * chore: Allow dead code * docs: Fix comment * docs: Update docs of acquire_lock
I hereby agree to the terms of the GreptimeDB CLA
What's changed and what's your intention?
This PR introduces a lock component for ProcedureManager. To implement lock, it also needs a
ProcedureMetastruct to track the metadata of a procedure in the manager.LockMapmanages all locks and it uses structLockto represent a lock entry.Only the owner procedure can hold the lock. Once it releases the lock, the lock entry pops the waiter from the queue and notifies the waiter procedure.
Checklist
Refer to a related PR or issue link (optional)