mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-01-10 15:14:09 +00:00
lib/storage: properly set time range when deleting time series
This commit is contained in:
parent
8126007c15
commit
c16e17dede
2 changed files with 6 additions and 2 deletions
|
@ -903,8 +903,12 @@ func (db *indexDB) DeleteTSIDs(tfss []*TagFilters) (int, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtain metricIDs to delete.
|
// Obtain metricIDs to delete.
|
||||||
|
tr := TimeRange{
|
||||||
|
MinTimestamp: 0,
|
||||||
|
MaxTimestamp: (1<<63)-1,
|
||||||
|
}
|
||||||
is := db.getIndexSearch()
|
is := db.getIndexSearch()
|
||||||
metricIDs, err := is.searchMetricIDs(tfss, TimeRange{}, 1e9)
|
metricIDs, err := is.searchMetricIDs(tfss, tr, 1e12)
|
||||||
db.putIndexSearch(is)
|
db.putIndexSearch(is)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
|
|
|
@ -581,7 +581,7 @@ func testStorageDeleteMetrics(s *Storage, workerNum int) error {
|
||||||
return fmt.Errorf("cannot delete metrics: %s", err)
|
return fmt.Errorf("cannot delete metrics: %s", err)
|
||||||
}
|
}
|
||||||
if deletedCount == 0 {
|
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 {
|
if n := metricBlocksCount(tfs); n != 0 {
|
||||||
return fmt.Errorf("expecting zero metric blocks after DeleteMetrics call for tfs=%s; got %d blocks", tfs, n)
|
return fmt.Errorf("expecting zero metric blocks after DeleteMetrics call for tfs=%s; got %d blocks", tfs, n)
|
||||||
|
|
Loading…
Reference in a new issue