You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
kvcoord: fix EndTxn elision race with in-flight requests
`TxnCoordSender` has a fast-path that avoids sending `EndTxn` requests
if the transaction has not taken out any locks. However, it relied on
`txnPipeliner` to keep track of locks, and it only registers these when
responses arrive. Since `EndTxn(commit=false)` requests can be sent
asynchronously (e.g. by the client disconnecting), these can arrive
while the write request is still in flight, causing `TxnCoordSender` to
incorrectly believe the transaction hasn't taken out any locks and elide
the `EndTxn` request. This would cause the written intents to be left
behind.
This patch changes `TxnCoordSender` to keep track of any locking
requests that have been sent, and only elides `EndTxn` requests when no
locking requests have been seen.
`txnCommitter` also elides `EndTxn` requests, but this is done below the
`txnFinalizeBarrier` which serializes the requests, so this is safe.
Release note (bug fix): Fixed a race condition where transaction
cleanup would not be triggered if the transaction was rolled back while
all locking requests were still in flight.
0 commit comments