Fix issue with series being added to log file

pull/9150/head
Edd Robinson 2017-10-02 17:11:57 +01:00 committed by Ben Johnson
parent 87778f3c45
commit 49218fd3bd
No known key found for this signature in database
GPG Key ID: 81741CD251883081
2 changed files with 14 additions and 1 deletions

View File

@ -438,8 +438,17 @@ func (f *LogFile) AddSeriesList(names [][]byte, tagsSlice []models.Tags) error {
return err return err
} }
if seriesIDs == nil {
// All of these series IDs exist in the index.
return nil
}
entries := make([]LogEntry, len(names)) entries := make([]LogEntry, len(names))
for i := range names { for i := range names {
if seriesIDs[i] == 0 {
// We don't need to allocate anything for this series.
continue
}
entries[i] = LogEntry{SeriesID: seriesIDs[i]} entries[i] = LogEntry{SeriesID: seriesIDs[i]}
} }
@ -447,6 +456,10 @@ func (f *LogFile) AddSeriesList(names [][]byte, tagsSlice []models.Tags) error {
defer f.mu.Unlock() defer f.mu.Unlock()
for i := range entries { for i := range entries {
if seriesIDs[i] == 0 {
// We don't need to add this series.
continue
}
if err := f.appendEntry(&entries[i]); err != nil { if err := f.appendEntry(&entries[i]); err != nil {
return err return err
} }

View File

@ -168,7 +168,7 @@ func (f *SeriesFile) CreateSeriesListIfNotExists(names [][]byte, tagsSlice []mod
// Return immediately if no series need to be created. // Return immediately if no series need to be created.
if !createRequired { if !createRequired {
return offsets, nil return nil, nil
} }
// Obtain write lock to create new series. // Obtain write lock to create new series.