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: fix incorrect chunk full judgement in parallel sort spill #54558

Merged
merged 4 commits into from
Jul 11, 2024
Merged
Changes from 1 commit
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
8 changes: 7 additions & 1 deletion pkg/executor/sortexec/parallel_sort_spill_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func newParallelSortSpillHelper(sortExec *SortExec, fieldTypes []*types.FieldTyp
errOutputChan: errOutputChan,
finishCh: finishCh,
fieldTypes: fieldTypes,
tmpSpillChunk: chunk.NewChunkFromPoolWithCapacity(fieldTypes, spillChunkSize),
xzhangxian1008 marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down Expand Up @@ -171,8 +170,15 @@ func (p *parallelSortSpillHelper) spillTmpSpillChunk(inDisk *chunk.DataInDiskByC
return nil
}

func (p *parallelSortSpillHelper) initForSpill() {
if p.tmpSpillChunk == nil {
p.tmpSpillChunk = chunk.NewChunkWithCapacity(p.fieldTypes, spillChunkSize)
}
}

func (p *parallelSortSpillHelper) spillImpl(merger *multiWayMerger) error {
logutil.BgLogger().Info(spillInfo, zap.Int64("consumed", p.bytesConsumed.Load()), zap.Int64("quota", p.bytesLimit.Load()))
p.initForSpill()
p.tmpSpillChunk.Reset()
inDisk := chunk.NewDataInDiskByChunks(p.fieldTypes)
inDisk.GetDiskTracker().AttachTo(p.sortExec.diskTracker)
Expand Down