Skip to content

Commit

Permalink
storage: undo quota acquisition on failed proposals
Browse files Browse the repository at this point in the history
This was an oversight introduced in #15802, the `undoQuotaAcquisition`
was intended to be used for all proposal errors but we seem to have
skipped the very first one. It seems to have been a relic of the earlier
structure where in the event of proposal errors the acquired quota was
released within `Replica.propose` itself, and not left to the caller.

Fixes (hopefully) #17826.
  • Loading branch information
irfansharif committed Aug 23, 2017
1 parent f12b6c7 commit cc4e8e5
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 @@ -2592,9 +2592,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 @@ -2605,6 +2602,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 cc4e8e5

Please sign in to comment.