code: func (it *copIterator) Next(ctx context.Context) (kv.ResultSubset, error) {
  	var (
  		resp   *copResponse
  		ok     bool
  		closed bool
  	)
  	// If data order matters, response should be returned in the same order as copTask slice.
  	// Otherwise all responses are returned from a single channel.
  	if it.respChan != nil {
  		// Get next fetched resp from chan
  		resp, ok, closed = it.recvFromRespCh(ctx, it.respChan)
  		if !ok || closed {
  			return nil, nil
  		}
  	} else {
  		for {
  			if it.curr >= len(it.tasks) {
  				// Resp will be nil if iterator is finishCh.
  				return nil, nil
  			}
  			task := it.tasks[it.curr]
  			resp, ok, closed = it.recvFromRespCh(ctx, task.respChan)
  			if closed {
  				// Close() is already called, so Next() is invalid.
  				return nil, nil
  			}
  			if ok {
  				break
  			}
  			// Switch to next task.
  			it.tasks[it.curr] = nil
  			it.curr++
  		}
  	}
  
  	if resp.err != nil {
  		return nil, errors.Trace(resp.err)
  	}
  
  	err := it.store.CheckVisibility(it.req.StartTs)
  	if err != nil {
  		return nil, errors.Trace(err)
  	}
  	return resp, nil
  }
docs: // Next returns next coprocessor result.
  // NOTE: Use nil to indicate finish, so if the returned ResultSubset is not nil, reader should continue to call Next().