Fix issue with series being added to log file
parent
87778f3c45
commit
49218fd3bd
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
||||||
|
|
Loading…
Reference in New Issue