diff --git a/go/vt/vtgate/engine/concatenate.go b/go/vt/vtgate/engine/concatenate.go index 04d08245b0e..2692f34695d 100644 --- a/go/vt/vtgate/engine/concatenate.go +++ b/go/vt/vtgate/engine/concatenate.go @@ -310,8 +310,15 @@ func (c *Concatenate) parallelStreamExec(inCtx context.Context, vcursor VCursor, return callback(resultChunk, currIndex) }) if err != nil { + muFields.Lock() + if rest[currIndex] == nil { + // In case we haven't received any fields yet, we need to set it + // empty, or otherwise we will keep waiting forever. + rest[currIndex] = &sqltypes.Result{} + } cancel() condFields.Broadcast() + muFields.Unlock() } return err })