lib/storage: properly set time range when deleting time series

This commit is contained in:
Aliaksandr Valialkin 2019-11-09 18:48:58 +02:00
parent 695c1dc5eb
commit 823fa085ef
2 changed files with 6 additions and 2 deletions

View File

@ -888,8 +888,12 @@ func (db *indexDB) DeleteTSIDs(tfss []*TagFilters) (int, error) {
}
// Obtain metricIDs to delete.
tr := TimeRange{
MinTimestamp: 0,
MaxTimestamp: (1<<63)-1,
}
is := db.getIndexSearch()
metricIDs, err := is.searchMetricIDs(tfss, TimeRange{}, 1e9)
metricIDs, err := is.searchMetricIDs(tfss, tr, 1e12)
db.putIndexSearch(is)
if err != nil {
return 0, err

View File

@ -541,7 +541,7 @@ func testStorageDeleteMetrics(s *Storage, workerNum int) error {
return fmt.Errorf("cannot delete metrics: %s", err)
}
if deletedCount == 0 {
return fmt.Errorf("expecting non-zero number of deleted metrics")
return fmt.Errorf("expecting non-zero number of deleted metrics on iteration %d", i)
}
if n := metricBlocksCount(tfs); n != 0 {
return fmt.Errorf("expecting zero metric blocks after DeleteMetrics call for tfs=%s; got %d blocks", tfs, n)