diff --git a/pkg/storage/replica.go b/pkg/storage/replica.go index 265b7477d973..38333d457674 100644 --- a/pkg/storage/replica.go +++ b/pkg/storage/replica.go @@ -5575,7 +5575,12 @@ func (r *Replica) processRaftCommand( } response.Intents = proposal.Local.DetachIntents() response.EndTxns = proposal.Local.DetachEndTxns(response.Err != nil) - lResult = proposal.Local + if pErr == nil { + lResult = proposal.Local + } + } + if pErr != nil && lResult != nil { + log.Fatalf(ctx, "shouldn't have a local result if command processing failed. pErr: %s", pErr) } // Handle the Result, executing any side effects of the last diff --git a/pkg/storage/replica_proposal.go b/pkg/storage/replica_proposal.go index d271a58db1c3..1b5b08449ca8 100644 --- a/pkg/storage/replica_proposal.go +++ b/pkg/storage/replica_proposal.go @@ -81,9 +81,10 @@ type ProposalData struct { // Always use ProposalData.finishApplication(). doneCh chan proposalResult - // Local contains the results of evaluating the request - // tying the upstream evaluation of the request to the - // downstream application of the command. + // Local contains the results of evaluating the request tying the upstream + // evaluation of the request to the downstream application of the command. + // Nil when the proposal came from another node (i.e. the evaluation wasn't + // done here). Local *result.LocalResult // Request is the client's original BatchRequest.