Commit 1ae507a
committed
kvcoord: always check for buffered writes when checking for locks
When reading through code for an unrelated reason we noted that there
was a call checking for acquired locks but not buffered writes. This is
concerning since the reasoning for why we need to check for acquired
locks almost always implies we should also check for buffered writes.
In the particular case of RollbackToSavepoint, I believe the omission
has no impact. Namely:
- Previous writes have been cleared from the buffer and thus aren't in
danger of failing to be rolled back.
- Subsequent writes will bump the sequence number and thus those
writes are not in danger of being erroneously rolled back.
- Subsequent reads cannot read the data that should have been rolled
back because it will have been cleared from the buffer.
Further, for real-world SQL transactions, we never have a buffered write
without having at least 1 lock.
However, for the avoidance fo doubt, we now check both and add a new
method to avoid missing checks in the future.
Fixes cockroachdb#155975
Release note: None1 parent b2be406 commit 1ae507a
File tree
2 files changed
+8
-5
lines changed- pkg/kv/kvclient/kvcoord
2 files changed
+8
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
527 | 527 | | |
528 | 528 | | |
529 | 529 | | |
530 | | - | |
531 | | - | |
| 530 | + | |
532 | 531 | | |
533 | 532 | | |
534 | 533 | | |
| |||
1724 | 1723 | | |
1725 | 1724 | | |
1726 | 1725 | | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
| 163 | + | |
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| |||
0 commit comments