Skip to content

Commit

Permalink
Merge pull request #22797 from spencerkimball/fix-22543
Browse files Browse the repository at this point in the history
storage: respect txn deadline with local retries for 1PC
  • Loading branch information
vivekmenezes authored Feb 20, 2018
2 parents 6db4036 + 3bb1c9c commit 6ce6e95
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/storage/replica.go
Original file line number Diff line number Diff line change
Expand Up @@ -5170,7 +5170,8 @@ func (r *Replica) evaluateWriteBatch(
batch, br, res, pErr := r.evaluateWriteBatchWithLocalRetries(
ctx, idKey, rec, &ms, strippedBa, spans, retryLocally,
)
if pErr == nil && (ba.Timestamp == br.Timestamp || retryLocally) {
if pErr == nil && (ba.Timestamp == br.Timestamp ||
(retryLocally && !isEndTransactionExceedingDeadline(br.Timestamp, *etArg))) {
clonedTxn := ba.Txn.Clone()
clonedTxn.Writing = true
clonedTxn.Status = roachpb.COMMITTED
Expand Down Expand Up @@ -5282,7 +5283,7 @@ func isOnePhaseCommit(ba roachpb.BatchRequest, knobs *StoreTestingKnobs) bool {
return false
}
etArg := arg.(*roachpb.EndTransactionRequest)
if isEndTransactionExceedingDeadline(ba.Header.Timestamp, *etArg) {
if isEndTransactionExceedingDeadline(ba.Txn.Timestamp, *etArg) {
return false
}
if retry, _ := isEndTransactionTriggeringRetryError(ba.Txn, *etArg); retry {
Expand Down

0 comments on commit 6ce6e95

Please sign in to comment.