Skip to content

Commit

Permalink
kv: don't close TCS interceptors on errors
Browse files Browse the repository at this point in the history
Before this patch, the TxnCoordSender was closing all the interceptors
when on non-retriable errors. This was a useless optimization serving to
stop the heartbeat loop early; the client was required to send a
rollback to clean up the intents.
This patch gets rid of the optimization in anticipation of the
savepoints API, which will serve for error recovery.

Release note: None
  • Loading branch information
andreimatei committed Dec 28, 2019
1 parent 8f946b8 commit 6997710
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/kv/txn_coord_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -770,15 +770,14 @@ func (tc *TxnCoordSender) updateStateLocked(
return roachpb.NewError(err)
}

// This is the non-retriable error case.
// This is the non-retriable error case. The client is expected to send a
// rollback.
if errTxn := pErr.GetTxn(); errTxn != nil {
tc.mu.txnState = txnError
tc.mu.storedErr = roachpb.NewError(&roachpb.TxnAlreadyEncounteredErrorError{
PrevError: pErr.String(),
})
// Cleanup.
tc.mu.txn.Update(errTxn)
tc.cleanupTxnLocked(ctx)
}
return pErr
}
Expand Down

0 comments on commit 6997710

Please sign in to comment.