Repository navigation
Add an operation lease framework backed by ZooKeeper ephemeral nodes - #20381
Draft
J-HowHuang wants to merge 1 commit into
Draft
J-HowHuang wants to merge 1 commit into
J-HowHuang wants to merge 1 commit into
Conversation
J-HowHuang
marked this pull request as draft
November 25, 2026 03:32
J-HowHuang
force-pushed
the
pinot-operation-lease
branch
from
November 25, 2026 03:33
77aaa1a to
b763bac
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #20381 +/- ##
==========================================
Coverage 71.47% 71.48%
Complexity 1639 1639
==========================================
Files 3615 3618 +3
Lines 244521 244668 +147
Branches 39767 39788 +21
==========================================
+ Hits 174764 174891 +127
- Misses 56572 56580 +8
- Partials 13185 13197 +12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds an operation lease framework to
pinot-common: an advisory, exclusive right to run one operation, held as an EPHEMERAL ZNode in the Helix property store. It lets replicas (or any other components) that would run the same work on a shared resource agree that one of them does it while the others wait for it, skip it, or do something else.PinotOperationLeaseUtils:tryAcquire,awaitRelease(watch-based, no polling, bounded by a max wait),getLeaseInfoandforceRelease. A lease is named by a table and an opaque, caller-built key. The key becomes one ZNode under/OPERATION_LEASES/<tableNameWithType>/; the framework validates ZNode name rules and hashes keys over 1 KB (sha256-<hex>, with the full key kept in the node data). Each method also takes a full property store path, for a caller that keeps an existing ZNode.PinotOperationLease(AutoCloseable):isHeld/checkOwnershipcompare the ZNode's ephemeral owner with the manager's current session, so a session expiry ends the lease on both sides.releaseis idempotent and never deletes a ZNode created by another session.PinotHelixResourceManagerremoves a table's lease directory when the table is deleted.No existing code path takes a lease yet.
Testing
PinotOperationLeaseUtilsTest(13 tests, embedded ZooKeeper, one session per simulated instance): only one instance holds a lease; release lets another acquire and never deletes another session's lease; a session end releases the lease and a session change ends it;awaitReleasewakes on release and returns at once when free; acquire fails while disconnected;forceReleaseon a missing lease; table deletion removes held leases; full-path leases; key validation and hashing of long keys.