-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/client: Make the lease manager thread-safe
This race was exceptionally rare due to how the lease manager is typically used by the sqlmigrations package, but it is indeed a race. Holding a semaphore while making a remote RPC is usually a terrible idea, but in the context of how it's used it's actually more dangerous to let ExtendLease and ReleaseLease interleave, since if ReleaseLease's CPut fails then the sqlmigrations package will log.Fatal, and the only potential for lock contention is between one goroutine using ExtendLease and one running ReleaseLease. Perhaps this is tuning the package too tightly to the needs of its client, but as of now it's its only client. Fixes #28222 Release note: None
- Loading branch information
1 parent
f123c03
commit c9cfe12
Showing
1 changed file
with
31 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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