-
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.
kv,client,storage: rationalize TxnCoordSender/client.Txn redundant st…
…ates client.Txn and TCS try to maintain a bunch of logically-redundant state about whether a transaction is "writing" - essentially whether an EndTransaction needs to be sent to cleanup up the TCS heartbeat loop and the server's txn record. The logic that both parties used for this was complex (e.g. it involved updates in both Txn and TCS both on the outgoing path and on the returning path of a batch) and not in sync - sometimes the TCS would consider the txn as "writing" and the client.Txn wouldn't (e.g. in case the first writing batch got an ambiguous error). This patch simplifies things: the idea is that, if a BeginTxn has been sent, an EndTransaction needs to be sent, period. The client.Txn thus only keeps track of whether a BeginTxn was sent (except for a 1PC batch), and it takes charge of starting the TCS' heartbeat loop (by instructing it explicitly directly to start it before the BeginTxn is sent). The TCS is no longer burdened with maintaining any state about whether there is a txn record or not. As a byproduct, the proto Transaction.Writing flag, which used to have an unclear meaning, becomes straight forward: if set, the server needs to check batches against the abort cache. The client is the only one setting it, the server is the only one checking it. It used to be used for different purposeses by both the client and server. Release note: none
- Loading branch information
1 parent
6f4e9b2
commit 990ca52
Showing
20 changed files
with
338 additions
and
251 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
Oops, something went wrong.