-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
112845: storage: fix data race in MVCCPredicateDeleteRange r=msbutler a=stevendanna This fixes two bugs in MVCCPredicateDeleteRange that would result in incorrect logical operations being published to rangefeeds. When publishing a logical operation, the caller indicates whether the buffers provide for the Key and EndKey of the operation are safe for concurrent use by setting a `Safe` boolean field in the published operation. MVCCPredicateDeleteRange calls either MVCCDeleteRangeUsingTombstone or mvccPutInternal, both of which publish logical opts with Safe set to true. Unfortunatelely, the code in MVCCPredicateDeleteRange _did_ invalidate the keys passed to these functions. As a result, it was possible for rangefeeds to observe: 1. Range keys with incorrect bounds, 2. Missed pointed deletions events, 3. Unnecessarily duplicated point deletions, and 4. Point deletions that never occurred (but were part of range deletions). Additionally, since we expect to be able to read the values for a logical operation back out of storage, rangefeeds may also encounter errors as they failed to read back the value for an erroneous events. Fixes #112733 Epic: none Release note(bug fix): Fix a bug that would result in incorrect physical replication results for users of the private preview physical replication feature. 113520: kvserver: prevent infinite lock discovery hazard on replayed writes r=nvanbenschoten a=arulajmani This patch prevents the possible infinite lock discovery hazard identified in #112409 and adds a regression test for it. We prevent the hazard by using the lock acquisition constructed by `mvccPutInternal` and bubbled up in 6abea12 instead of constructing it later a few layers above. As no lock acquisition struct is constructed for replayed writes, we no longer communicate the wrong intent timestamp to the lock table. I've verified that the test I added fails with the following diff applied: ```go --- a/pkg/storage/mvcc.go +++ b/pkg/storage/mvcc.go `@@` -2338,7 +2338,7 `@@` func mvccPutInternal( // transaction's write timestamp in cases where it was originally // written at a lower timestamp. return false, - roachpb.LockAcquisition{}, + roachpb.MakeLockAcquisition(opts.Txn.TxnMeta, key, lock.Replicated, lock.Intent, opts.Txn.IgnoredSeqNums), replayTransactionalWrite(ctx, iter, meta, key, value, opts.Txn, valueFn, opts.ReplayWriteTimestampProtection, ) ``` Closes #112409 Release note: None Co-authored-by: Steven Danna <[email protected]> Co-authored-by: Arul Ajmani <[email protected]>
- Loading branch information
Showing
16 changed files
with
309 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.