Skip to content

Commit

Permalink
executor: add memory track in handle cop request (pingcap#38755) (pin…
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Jan 7, 2023
1 parent 4b777b4 commit 52ae590
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions executor/coprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func (h *CoprocessorDAGHandler) HandleRequest(ctx context.Context, req *coproces
chk := newFirstChunk(e)
tps := e.base().retFieldTypes
var totalChunks, partChunks []tipb.Chunk
memTracker := h.sctx.GetSessionVars().StmtCtx.MemTracker
for {
chk.Reset()
err = Next(ctx, e, chk)
Expand All @@ -76,6 +77,9 @@ func (h *CoprocessorDAGHandler) HandleRequest(ctx context.Context, req *coproces
if err != nil {
return h.buildErrorResponse(err)
}
for _, ch := range partChunks {
memTracker.Consume(int64(ch.Size()))
}
totalChunks = append(totalChunks, partChunks...)
}
if err := e.Close(); err != nil {
Expand Down

0 comments on commit 52ae590

Please sign in to comment.