Commit d1be8a1c authored by Nathan VanBenschoten's avatar Nathan VanBenschoten

kv/kvclient: avoid letting BatchRequests escape to heap

The first one in `divideAndSendBatchToRanges` was caused by #50633.

While here, avoid the allocation in `divideAndSendParallelCommit`.
parent 0b65365f
......@@ -664,7 +664,7 @@ func unsetCanForwardReadTimestampFlag(ctx context.Context, ba *roachpb.BatchRequ
// Assert this for our own sanity.
if _, ok := ba.GetArg(roachpb.EndTxn); ok {
log.Fatalf(ctx, "batch unexpected contained requests "+
"that need to refresh and an EndTxn request: %s", ba)
"that need to refresh and an EndTxn request: %s", ba.String())
}
return
}
......@@ -874,6 +874,7 @@ func (ds *DistSender) divideAndSendParallelCommit(
}
qiBatchIdx := batchIdx + 1
qiResponseCh := make(chan response, 1)
qiBaCopy := qiBa // avoids escape to heap
runTask := ds.rpcContext.Stopper.RunAsyncTask
if ds.disableParallelBatches {
......@@ -949,7 +950,7 @@ func (ds *DistSender) divideAndSendParallelCommit(
}
// Populate the pre-commit QueryIntent batch response. If we made it
// here then we know we can ignore intent missing errors.
qiReply.reply = qiBa.CreateReply()
qiReply.reply = qiBaCopy.CreateReply()
for _, ru := range qiReply.reply.Responses {
ru.GetQueryIntent().FoundIntent = true
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment