Skip to content

Commit

Permalink
concurrency: use lock modes to find conflicts during lock table scans
Browse files Browse the repository at this point in the history
This patch majorly refactors the lock table scan codepath, all in the
name of shared locks. At its core is a desire to use lock modes to
perform conflict resolution between an incoming request and locks held
on one particular key. In doing so, we rip out tryActiveWait.

At a high level (for a particular key), a request's journey looks like
the following:

- It first checks if the transaction already holds a lock at a equal or
higher lock strength (read: It's good enough for its use). If this is
the case, it can proceed without any bookkeeping.
- It then checks if any finalized transactions hold locks on the key.
Such locks do not conflict, but need to be resolved before the
transaction can evaluate. They're thus accumulated for later.
- The request then enqueues itself in the appropriate wait queue.
- It then determines if it needs to actively wait at this lock because
of a conflict. If that's the case, the lock table scan short circuits.
- Otherwise, the request lays a claim (if it can) before proceeding with
its scan.

Closes #102210

Release note: None
  • Loading branch information
arulajmani committed Jun 27, 2023
1 parent 19b8fca commit a2aa8b7
Show file tree
Hide file tree
Showing 2 changed files with 462 additions and 284 deletions.
Loading

0 comments on commit a2aa8b7

Please sign in to comment.