forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kv: disallow 1PC evaluation when heartbeating and txn record present
Fixes cockroachdb#53403. Fixes cockroachdb#53518. Fixes cockroachdb#53772 Fixes cockroachdb#54094. This commit disables one-phase commit evaluation for transactions with existing PENDING transaction records. As we saw in cockroachdb#53518 (comment), failing to do so can lead to a transaction that commits on the one-phase commit fast-path but still has a PENDING transaction record. It doesn't seem like this can actually cause serious correctness issues today other than in the presence of replays because a 1PC transaction does not have remote intents (by definition). However, it was creating the appearance of abandoned transaction records in `kv/contention/nodes=4` and causing that test to fail. This commit needs a backport to release-20.2 and release-20.1. This was not an issue before release-20.1 because before then, we would never begin a transaction's heartbeat loop for 1PC transactions. This changed in v20.1 because of unreplicated locks. We allow transactions that acquire unreplicated locks to still hit the one-phase commit fast-path, but we also need to start heartbeating once a transaction has acquired any locks so that it doesn't get aborted by conflicting transactions. In the vast majority of these cases, the heartbeat loop will never actually fire (for any txn that takes less than 1s), so with this change, we'll still be able to perform a 1PC evaluation. However, this is adding in a disk read for those cases, which is a little disappointing but doesn't seem easy to avoid without disabling the heartbeat loop before issuing the 1PC batch (another alternative, happy to discuss). The upside of this is that we now have enough information on the server to avoid a bit of work for 1PC txns that have not previously acquired locks (see TODO in evaluate1PC).
- Loading branch information
1 parent
7509e36
commit 4b18d34
Showing
9 changed files
with
896 additions
and
666 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.