-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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: add missing locking for txnState.mu.txn writes #33249
sql: add missing locking for txnState.mu.txn writes #33249
Conversation
Fixes cockroachdb#32523 Release note: None
Note that I'm still trying to reproduce the original failure, though I'm pretty sure this is the fix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
// Note that reads of mu.txn from the session's main goroutine do not require | ||
// acquiring a read lock - since only that goroutine will ever write to | ||
// mu.txn. | ||
// mu.txn. Writes to mu.txn do require a write lock to guarantee safety with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd argue that this comment is not needed, but I guess I've forfeited that right.
|
No reproduction via |
bors r=andreimatei |
33193: sql: remove maps from cfetcher hot path r=jordanlewis a=jordanlewis Closes #32968. Previously, the cfetcher used a Go map to keep track of the relationship between column id and column index, so that during decoding of value columns, it could put the decoded value in the correct spot depending on its column id. This was fairly expensive and showed up very heavily in profiles. This commit changes the approach used, by recognizing that within any given key/value pair, the encountered column ids will be strictly increasing. Thanks to this knowledge, it becomes cheap to use a regular list for storage of the mapping - instead of an O(n) lookup for every column value in a kv pair, it's O(n) for the whole kv pair, since we can save our position within the sorted list of required column ids. This reduces the time spent in the cfetcher's ProcessValueBytes method from 30% to 10% for a large scan. Release note: None 33248: diagnosticspb: restore deleted fields r=dt a=dt We don't actually want to delete fields since older nodes will still be writing them, and we use the same proto to decode reported diagnostics data so it wants to read those. Instead we can just prefix them so it is clear they're not used. Release note: none 33249: sql: add missing locking for txnState.mu.txn writes r=andreimatei a=petermattis Fixes #32523 Release note: None Co-authored-by: Jordan Lewis <jordanthelewis@gmail.com> Co-authored-by: David Taylor <tinystatemachine@gmail.com> Co-authored-by: Peter Mattis <petermattis@gmail.com>
Build succeeded |
Fixes #32523
Release note: None