lib/storage: always start using per-day inverted index on the next day after its creation

The current day could miss entries for already stopped time series before
enabling per-day index.

This fixes the issue when queries return empty results during the first hour after
upgrading to v1.29.*
This commit is contained in:
Aliaksandr Valialkin 2019-11-16 12:11:22 +02:00
parent c050abbbad
commit 2ab4cea5e5

View file

@ -1001,8 +1001,9 @@ func (is *indexSearch) getStartDateForPerDayInvertedIndex() (uint64, error) {
if err := ts.Error(); err != nil {
return 0, err
}
// The database is empty. Return the current date.
return minDate, nil
// There are no (date,tag)->metricIDs entries in the database yet.
// Return the next date, since the current date may contain unindexed data.
return minDate + 1, nil
}
func (is *indexSearch) loadDeletedMetricIDs() (*uint64set.Set, error) {