kv: fix intent tracking#26606
Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom Jun 12, 2018
Merged
Conversation
I've introduced a bug in cockroachdb#26497 - if there's concurrent writing requests going though a single client.Txn, it can be that some of the intents are not tracked correctly. Before this patch, intents started being tracked when the TxnCoordSender sees a BeginTransaction. Even through the client.Txn attaches an EndTransaction to the first writing requests that it sees, a 2nd request might pass through and get to the TxnCoordSender before that BeginTxn. In fact, it might even get a response before the TxnCoordSender sees the BeginTxn, in which case we wouldn't have recorded its intents. This patch makes the TxnCoordSender track intents from all writing requests. The BeginTxn doesn't matter for tracking intents any more. It continues to matter for starting the heartbeat loop. We could alternatively move to starting the hb loop when seeing the first write, but I didn't do it. Fixes cockroachdb#26538 Release note: None
Member
nvb
approved these changes
Jun 11, 2018
Contributor
|
Reviewed 3 of 3 files at r1. Comments from Reviewable |
Contributor
Author
|
bors r+ Review status: Comments from Reviewable |
craig bot
pushed a commit
that referenced
this pull request
Jun 12, 2018
26606: kv: fix intent tracking r=andreimatei a=andreimatei I've introduced a bug in #26497 - if there's concurrent writing requests going though a single client.Txn, it can be that some of the intents are not tracked correctly. Before this patch, intents started being tracked when the TxnCoordSender sees a BeginTransaction. Even through the client.Txn attaches an EndTransaction to the first writing requests that it sees, a 2nd request might pass through and get to the TxnCoordSender before that BeginTxn. In fact, it might even get a response before the TxnCoordSender sees the BeginTxn, in which case we wouldn't have recorded its intents. This patch makes the TxnCoordSender track intents from all writing requests. The BeginTxn doesn't matter for tracking intents any more. It continues to matter for starting the heartbeat loop. We could alternatively move to starting the hb loop when seeing the first write, but I didn't do it. Fixes #26538 Release note: None Co-authored-by: Andrei Matei <andrei@cockroachlabs.com>
Contributor
Build succeeded |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've introduced a bug in #26497 - if there's concurrent writing requests
going though a single client.Txn, it can be that some of the intents
are not tracked correctly. Before this patch, intents started being
tracked when the TxnCoordSender sees a BeginTransaction. Even through
the client.Txn attaches an EndTransaction to the first writing requests
that it sees, a 2nd request might pass through and get to the
TxnCoordSender before that BeginTxn. In fact, it might even get a
response before the TxnCoordSender sees the BeginTxn, in which case we
wouldn't have recorded its intents.
This patch makes the TxnCoordSender track intents from all writing
requests. The BeginTxn doesn't matter for tracking intents any more. It
continues to matter for starting the heartbeat loop. We could
alternatively move to starting the hb loop when seeing the first write,
but I didn't do it.
Fixes #26538
Release note: None