Merged
Conversation
Prevent a transaction from being added to the wait queue multiple times across retry attempts by tracking `addedToWaitQueue`. Also clean up the wait queue and dependency graph when the retry loop times out, avoiding stale state in subsequent lock acquisitions.
Documents the 2PL protocol, supported lock modes, internal subsystems (LockTable, WaitQueue, DependencyGraph, LockGrantor), the lock acquisition flow, deadlock detection strategy, and the invariants the package upholds.
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.
Fix duplicate wait-queue entries and timeout leak in lock manager
Title: Fix duplicate wait-queue entries and timeout leak in lock manager
Summary:
LockManager.attemptToAcquireLockwas re-adding the same transaction to the wait queue and dependency graph on every failed attempt, causing duplicate entries and incorrect deadlock detection.FuzzLexerCI step was removed (it no longer exists or is covered elsewhere).pkg/concurrency/lockdocumenting the 2PL protocol, components, lock acquisition flow, and invariants.Changes:
pkg/concurrency/lock/manager.go— guard wait-queue insertion and dependency tracking behind anaddedToWaitQueueflag so they only run once per acquisition attempt; clean up queue and graph on timeout.pkg/concurrency/lock/docs.go— new file with package-level godoc coveringLockManager,LockTable,WaitQueue,DependencyGraph,LockGrantor, and all relevant invariants..github/workflows/ci.yml— remove theFuzzLexerfuzz step from the CI workflow.