MCPcopy Create free account
hub / github.com/pingcap/tidb / Next

Method Next

pkg/executor/parallel_apply.go:137–166  ·  view source on GitHub ↗

Next implements the Executor interface.

(ctx context.Context, req *chunk.Chunk)

Source from the content-addressed store, hash-verified

135
136// Next implements the Executor interface.
137func (e *ParallelNestedLoopApplyExec) Next(ctx context.Context, req *chunk.Chunk) (err error) {
138 if atomic.LoadUint32(&e.drained) == 1 {
139 req.Reset()
140 return nil
141 }
142
143 if atomic.CompareAndSwapUint32(&e.started, 0, 1) {
144 e.workerWg.Add(1)
145 go e.outerWorker(ctx)
146 for i := 0; i < e.concurrency; i++ {
147 e.workerWg.Add(1)
148 workID := i
149 go e.innerWorker(ctx, workID)
150 }
151 e.notifyWg.Add(1)
152 go e.notifyWorker(ctx)
153 }
154 result := <-e.resultChkCh
155 if result.err != nil {
156 return result.err
157 }
158 if result.chk == nil { // no more data
159 req.Reset()
160 atomic.StoreUint32(&e.drained, 1)
161 return nil
162 }
163 req.SwapColumns(result.chk)
164 e.freeChkCh <- result.chk
165 return nil
166}
167
168// Close implements the Executor interface.
169func (e *ParallelNestedLoopApplyExec) Close() error {

Callers

nothing calls this directly

Calls 6

outerWorkerMethod · 0.95
innerWorkerMethod · 0.95
notifyWorkerMethod · 0.95
ResetMethod · 0.65
AddMethod · 0.65
SwapColumnsMethod · 0.45

Tested by

no test coverage detected