@@ -183,6 +183,7 @@ type proposalResult struct {
183183 Reply * roachpb.BatchResponse
184184 Err * roachpb.Error
185185 ProposalRetry proposalRetryReason
186+ Intents []intentsWithArg
186187}
187188
188189type replicaChecksum struct {
@@ -1667,7 +1668,7 @@ func (r *Replica) addReadOnlyCmd(
16671668 if result .Local .intents != nil && len (* result .Local .intents ) > 0 {
16681669 log .Eventf (ctx , "submitting %d intents to asynchronous processing" ,
16691670 len (* result .Local .intents ))
1670- r .store .intentResolver .processIntentsAsync (r , * result .Local .intents )
1671+ r .store .intentResolver .processIntents (r , * result .Local .intents )
16711672 }
16721673 if pErr != nil {
16731674 log .ErrEvent (ctx , pErr .String ())
@@ -1869,6 +1870,11 @@ func (r *Replica) tryAddWriteCmd(
18691870 // Set endCmds to nil because they have already been invoked
18701871 // in processRaftCommand.
18711872 endCmds = nil
1873+ if propResult .Intents != nil {
1874+ // Synchronously process any intents that need resolving here in order
1875+ // to apply back pressure on the client which generated them.
1876+ r .store .intentResolver .processIntents (r , propResult .Intents )
1877+ }
18721878 return propResult .Reply , propResult .Err , propResult .ProposalRetry
18731879 case <- ctxDone :
18741880 // If our context was cancelled, return an AmbiguousResultError
@@ -2077,12 +2083,13 @@ func (r *Replica) propose(
20772083 // An error here corresponds to a failfast-proposal: The command resulted
20782084 // in an error and did not need to commit a batch (the common error case).
20792085 if pErr != nil {
2086+ intents := pCmd .Local .detachIntents ()
20802087 r .handleEvalResult (ctx , repDesc , pCmd .Local , pCmd .Replicated )
20812088 if endCmds != nil {
20822089 endCmds .done (nil , pErr , proposalNoRetry )
20832090 }
20842091 ch := make (chan proposalResult , 1 )
2085- ch <- proposalResult {Err : pErr }
2092+ ch <- proposalResult {Err : pErr , Intents : intents }
20862093 close (ch )
20872094 return ch , func () bool { return false }, nil
20882095 }
@@ -3287,6 +3294,7 @@ func (r *Replica) processRaftCommand(
32873294 } else {
32883295 log .Fatalf (ctx , "proposal must return either a reply or an error: %+v" , cmd )
32893296 }
3297+ response .Intents = cmd .Local .detachIntents ()
32903298 lResult = cmd .Local
32913299 }
32923300
@@ -4228,7 +4236,7 @@ func (r *Replica) loadSystemConfigSpan() ([]roachpb.KeyValue, []byte, error) {
42284236 // There were intents, so what we read may not be consistent. Attempt
42294237 // to nudge the intents in case they're expired; next time around we'll
42304238 // hopefully have more luck.
4231- r .store .intentResolver .processIntentsAsync (r , * result .Local .intents )
4239+ r .store .intentResolver .processIntents (r , * result .Local .intents )
42324240 return nil , nil , errSystemConfigIntent
42334241 }
42344242 kvs := br .Responses [0 ].GetInner ().(* roachpb.ScanResponse ).Rows
0 commit comments