You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit aea143a
Browse filesBrowse the repository at this point in the historyBrowse files
fix(storage): stop workspace ledger locks from deadlocking on FK key-share
Workspace storage accounting locked the workspace, organization, and
user_stats rows with SELECT ... FOR UPDATE. Those rows are foreign-key
parents, so a transaction that has already written a billable child row
holds an implicit FOR KEY SHARE on the parent, and the stronger lock is
an upgrade that two concurrent uploads take on each other.
Take FOR NO KEY UPDATE instead. It does not conflict with FOR KEY SHARE,
still conflicts with itself, and is the lock a plain UPDATE of these
non-key counters takes anyway, so the ledgers stay serialized.
0 commit comments