Skip to content

Commit

Permalink
Fix rightjoin.Free hung (#17107)
Browse files Browse the repository at this point in the history
Do not read from channel in Free()

Approved by: @m-schen, @aunjgr, @sukki37
  • Loading branch information
zengyan1 authored Jun 24, 2024
1 parent 22a2268 commit 0eed606
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 24 deletions.
10 changes: 2 additions & 8 deletions pkg/sql/colexec/right/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,8 @@ func (arg *Argument) Release() {
func (arg *Argument) Free(proc *process.Process, pipelineFailed bool, err error) {
ctr := arg.ctr
if ctr != nil {
if !ctr.handledLast && arg.NumCPU > 1 {
if arg.IsMerger {
for i := uint64(1); i < arg.NumCPU; i++ {
<-arg.Channel
}
} else {
arg.Channel <- nil
}
if !ctr.handledLast && arg.NumCPU > 1 && !arg.IsMerger {
arg.Channel <- nil
}
ctr.cleanBatch(proc)
ctr.cleanHashMap()
Expand Down
10 changes: 2 additions & 8 deletions pkg/sql/colexec/rightanti/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,8 @@ func (arg *Argument) Release() {
func (arg *Argument) Free(proc *process.Process, pipelineFailed bool, err error) {
ctr := arg.ctr
if ctr != nil {
if !ctr.handledLast && arg.NumCPU > 1 {
if arg.IsMerger {
for i := uint64(1); i < arg.NumCPU; i++ {
<-arg.Channel
}
} else {
arg.Channel <- nil
}
if !ctr.handledLast && arg.NumCPU > 1 && !arg.IsMerger {
arg.Channel <- nil
}
ctr.cleanBatch(proc)
ctr.cleanEvalVectors()
Expand Down
10 changes: 2 additions & 8 deletions pkg/sql/colexec/rightsemi/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,8 @@ func (arg *Argument) Release() {
func (arg *Argument) Free(proc *process.Process, pipelineFailed bool, err error) {
ctr := arg.ctr
if ctr != nil {
if !ctr.handledLast && arg.NumCPU > 1 {
if arg.IsMerger {
for i := uint64(1); i < arg.NumCPU; i++ {
<-arg.Channel
}
} else {
arg.Channel <- nil
}
if !ctr.handledLast && arg.NumCPU > 1 && !arg.IsMerger {
arg.Channel <- nil
}
ctr.cleanBatch(proc)
ctr.cleanEvalVectors()
Expand Down

0 comments on commit 0eed606

Please sign in to comment.