fix(tsdb): Fix panic, don't add nil iterator to slice

fixes #10171
pull/10188/head
Stuart Carnie 2018-08-08 12:14:50 -07:00
parent f70fb7a631
commit 990824ceca
1 changed files with 8 additions and 4 deletions

View File

@ -2179,8 +2179,9 @@ func (is IndexSet) matchTagValueEqualEmptySeriesIDIterator(name, key []byte, val
itr, err := is.tagValueSeriesIDIterator(name, key, e)
if err != nil {
return err
} else if itr != nil {
itrs = append(itrs, itr)
}
itrs = append(itrs, itr)
}
}
return nil
@ -2222,8 +2223,9 @@ func (is IndexSet) matchTagValueEqualNotEmptySeriesIDIterator(name, key []byte,
if err != nil {
SeriesIDIterators(itrs).Close()
return nil, err
} else if itr != nil {
itrs = append(itrs, itr)
}
itrs = append(itrs, itr)
}
}
return MergeSeriesIDIterators(itrs...), nil
@ -2253,8 +2255,9 @@ func (is IndexSet) matchTagValueNotEqualEmptySeriesIDIterator(name, key []byte,
if err != nil {
SeriesIDIterators(itrs).Close()
return nil, err
} else if itr != nil {
itrs = append(itrs, itr)
}
itrs = append(itrs, itr)
}
}
return MergeSeriesIDIterators(itrs...), nil
@ -2283,8 +2286,9 @@ func (is IndexSet) matchTagValueNotEqualNotEmptySeriesIDIterator(name, key []byt
if err != nil {
SeriesIDIterators(itrs).Close()
return nil, err
} else if itr != nil {
itrs = append(itrs, itr)
}
itrs = append(itrs, itr)
}
}