Skip to content

Commit

Permalink
Merge pull request #17856 from irfansharif/qpool-err-release
Browse files Browse the repository at this point in the history
storage: undo quota acquisition on failed proposals
  • Loading branch information
irfansharif authored Aug 23, 2017
2 parents a9b9e1d + cc4e8e5 commit f652468
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/storage/replica.go
Original file line number Diff line number Diff line change
Expand Up @@ -2589,9 +2589,6 @@ func (r *Replica) tryExecuteWriteBatch(
log.Event(ctx, "applied timestamp cache")

ch, tryAbandon, undoQuotaAcquisition, pErr := r.propose(ctx, lease, ba, endCmds, spans)
if pErr != nil {
return nil, pErr, proposalNoRetry
}
defer func() {
// NB: We may be double free-ing here, consider the following cases:
// - The request was evaluated and the command resulted in an error, but a
Expand All @@ -2602,6 +2599,9 @@ func (r *Replica) tryExecuteWriteBatch(
undoQuotaAcquisition()
}
}()
if pErr != nil {
return nil, pErr, proposalNoRetry
}

// After the command is proposed to Raft, invoking endCmds.done is now the
// responsibility of processRaftCommand.
Expand Down

0 comments on commit f652468

Please sign in to comment.