-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sql: reduce contention between session (de)registration and query cancelation #95535
Labels
C-bug
Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
T-sql-foundations
SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Comments
Where is the session registry lock held? So far I only found one usage: cockroach/pkg/server/status.go Line 219 in 9735954
|
There are more usages in the SessionRegistry methods below the struct. |
craig bot
pushed a commit
that referenced
this issue
Jan 20, 2023
95553: sql: reduce contention on `SessionRegistry` mutex r=yuzefovich,rafiss a=ecwall Fixes #95535 This reduces `SessionRegistry` contention in 2 ways: 1) Change `SessionRegistry` `syncutil.Mutex` to `syncutil.RWMutex` and use `RLock()` in place of `Lock()` when not modifying the registry. 2) Only lock reading/writing `SessionRegistry` maps with mutex instead of including the session operations in the lock. Release note (bug fix): Reduce register session, deregister session, and session cancel query contention. 95573: sql,multitenant: simplify the cap pb package name r=arulajmani a=knz Fixes #95572 proto packages don't need to have a relationship with the filesystem path. Release note: None Co-authored-by: Evan Wall <[email protected]> Co-authored-by: Raphael 'kena' Poss <[email protected]>
blathers-crl bot
pushed a commit
that referenced
this issue
Jan 20, 2023
Fixes #95535 This reduces `SessionRegistry` contention in 2 ways: 1) Change `SessionRegistry` `syncutil.Mutex` to `syncutil.RWMutex` and use `RLock()` in place of `Lock()` when not modifying the registry. 2) Only lock reading/writing `SessionRegistry` maps with mutex instead of including the session operations in the lock. Release note (bug fix): Reduce register session, deregister session, and session cancel query contention.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-bug
Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
T-sql-foundations
SQL Foundations Team (formerly SQL Schema + SQL Sessions)
The
SessionRegistry
contains a mutex is used for session registration, de-registration, and query cancelation:cockroach/pkg/sql/exec_util.go
Line 2065 in 9735954
Registration and de-registration are fast and should not hold the lock very long, but query cancelation can be long running.
We should be able to use the mutex to lock looking up the session, but release it after the session has been looked up for the duration of the query cancelations.
Jira issue: CRDB-23574
The text was updated successfully, but these errors were encountered: