code: func (p *Partition) createSeriesListIfNotExists(collection *tsdb.SeriesCollection) ([]tsdb.SeriesID, error) {
  	// Is there anything to do? The partition may have been sent an empty batch.
  	if collection.Length() == 0 {
  		return nil, nil
  	} else if len(collection.Names) != len(collection.Tags) {
  		return nil, fmt.Errorf("uneven batch, partition %s sent %d names and %d tags", p.id, len(collection.Names), len(collection.Tags))
  	}
  
  	// Maintain reference count on files in file set.
  	fs, err := p.RetainFileSet()
  	if err != nil {
  		return nil, err
  	}
  	defer fs.Release()
  
  	// Ensure fileset cannot change during insert.
  	now := time.Now()
  	p.mu.RLock()
  	// Insert series into log file.
  	ids, err := p.activeLogFile.AddSeriesList(p.seriesIDSet, collection)
  	if err != nil {
  		p.mu.RUnlock()
  		return nil, err
  	}
  	p.mu.RUnlock()
  
  	if err := p.CheckLogFile(); err != nil {
  		return nil, err
  	}
  
  	// NOTE(edd): if this becomes expensive then we can move the count into the
  	// log file.
  	var totalNew uint64
  	for _, id := range ids {
  		if !id.IsZero() {
  			totalNew++
  		}
  	}
  	if totalNew > 0 {
  		p.tracker.AddSeriesCreated(totalNew, time.Since(now))
  		p.tracker.AddSeries(totalNew)
  		p.mu.RLock()
  		p.tracker.SetDiskSize(uint64(p.fileSet.Size()))
  		p.mu.RUnlock()
  	}
  	return ids, nil
  }
docs: // createSeriesListIfNotExists creates a list of series if they doesn't exist in
  // bulk.