diff --git a/lib/storage/index_db.go b/lib/storage/index_db.go index 4dc275a0e..f36f5eb7c 100644 --- a/lib/storage/index_db.go +++ b/lib/storage/index_db.go @@ -903,8 +903,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 diff --git a/lib/storage/storage_test.go b/lib/storage/storage_test.go index 82b956c9f..27814cf56 100644 --- a/lib/storage/storage_test.go +++ b/lib/storage/storage_test.go @@ -581,7 +581,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)