@@ -174,6 +174,16 @@ const (
174174 // so if the retry does not succeed, care must be taken to correctly inform
175175 // the caller via an AmbiguousResultError.
176176 proposalReproposed
177+ // proposalErrorReproposing indicates that re-proposal
178+ // failed. Because the original proposal may have succeeded, an
179+ // AmbiguousResultError must be returned. The command should not be
180+ // retried.
181+ proposalErrorReproposing
182+ // proposalRangeNoLongerExists indicates the proposal was for a
183+ // range that no longer exists. Because the original proposal may
184+ // have succeeded, an AmbiguousResultError must be returned. The
185+ // command should not be retried.
186+ proposalRangeNoLongerExists
177187)
178188
179189// proposalResult indicates the result of a proposal. Exactly one of
@@ -1705,10 +1715,12 @@ func (r *Replica) addWriteCmd(
17051715 br , pErr , retry := r .tryAddWriteCmd (ctx , ba )
17061716 switch retry {
17071717 case proposalIllegalLeaseIndex :
1708- continue
1718+ continue // retry
17091719 case proposalReproposed :
17101720 ambiguousResult = true
1711- continue
1721+ continue // retry
1722+ case proposalRangeNoLongerExists , proposalErrorReproposing :
1723+ ambiguousResult = true
17121724 }
17131725 if pErr != nil {
17141726 // If this isn't an end transaction with commit=true, return
@@ -2836,7 +2848,7 @@ func (r *Replica) refreshProposalsLocked(refreshAtDelta int, reason refreshRaftR
28362848 log .Eventf (p .Local .ctx , "re-submitting command %x to Raft: %s" , p .Local .idKey , reason )
28372849 if err := r .submitProposalLocked (p ); err != nil {
28382850 delete (r .mu .proposals , p .Local .idKey )
2839- p .Local .finish (proposalResult {Err : roachpb .NewError (err )})
2851+ p .Local .finish (proposalResult {Err : roachpb .NewError (err ), ProposalRetry : proposalErrorReproposing })
28402852 }
28412853 }
28422854}
0 commit comments