Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executor: add memory track in handle cop request (#38755) #38759

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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