fix sort pendingDateMetricsIDs (#4102)

This commit is contained in:
Haleygo 2023-04-11 01:16:36 +08:00 committed by Aliaksandr Valialkin
parent 1ca07a4f00
commit a1c4d00750
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1

View file

@ -1289,13 +1289,15 @@ func (s *Storage) DeleteSeries(qt *querytracer.Tracer, tfss []*TagFilters) (int,
// SearchLabelNamesWithFiltersOnTimeRange searches for label names matching the given tfss on tr. // SearchLabelNamesWithFiltersOnTimeRange searches for label names matching the given tfss on tr.
func (s *Storage) SearchLabelNamesWithFiltersOnTimeRange(qt *querytracer.Tracer, accountID, projectID uint32, tfss []*TagFilters, tr TimeRange, func (s *Storage) SearchLabelNamesWithFiltersOnTimeRange(qt *querytracer.Tracer, accountID, projectID uint32, tfss []*TagFilters, tr TimeRange,
maxLabelNames, maxMetrics int, deadline uint64) ([]string, error) { maxLabelNames, maxMetrics int, deadline uint64,
) ([]string, error) {
return s.idb().SearchLabelNamesWithFiltersOnTimeRange(qt, accountID, projectID, tfss, tr, maxLabelNames, maxMetrics, deadline) return s.idb().SearchLabelNamesWithFiltersOnTimeRange(qt, accountID, projectID, tfss, tr, maxLabelNames, maxMetrics, deadline)
} }
// SearchLabelValuesWithFiltersOnTimeRange searches for label values for the given labelName, filters and tr. // SearchLabelValuesWithFiltersOnTimeRange searches for label values for the given labelName, filters and tr.
func (s *Storage) SearchLabelValuesWithFiltersOnTimeRange(qt *querytracer.Tracer, accountID, projectID uint32, labelName string, tfss []*TagFilters, func (s *Storage) SearchLabelValuesWithFiltersOnTimeRange(qt *querytracer.Tracer, accountID, projectID uint32, labelName string, tfss []*TagFilters,
tr TimeRange, maxLabelValues, maxMetrics int, deadline uint64) ([]string, error) { tr TimeRange, maxLabelValues, maxMetrics int, deadline uint64,
) ([]string, error) {
return s.idb().SearchLabelValuesWithFiltersOnTimeRange(qt, accountID, projectID, labelName, tfss, tr, maxLabelValues, maxMetrics, deadline) return s.idb().SearchLabelValuesWithFiltersOnTimeRange(qt, accountID, projectID, labelName, tfss, tr, maxLabelValues, maxMetrics, deadline)
} }
@ -1305,7 +1307,8 @@ func (s *Storage) SearchLabelValuesWithFiltersOnTimeRange(qt *querytracer.Tracer
// //
// If more than maxTagValueSuffixes suffixes is found, then only the first maxTagValueSuffixes suffixes is returned. // If more than maxTagValueSuffixes suffixes is found, then only the first maxTagValueSuffixes suffixes is returned.
func (s *Storage) SearchTagValueSuffixes(qt *querytracer.Tracer, accountID, projectID uint32, tr TimeRange, tagKey, tagValuePrefix string, func (s *Storage) SearchTagValueSuffixes(qt *querytracer.Tracer, accountID, projectID uint32, tr TimeRange, tagKey, tagValuePrefix string,
delimiter byte, maxTagValueSuffixes int, deadline uint64) ([]string, error) { delimiter byte, maxTagValueSuffixes int, deadline uint64,
) ([]string, error) {
return s.idb().SearchTagValueSuffixes(qt, accountID, projectID, tr, tagKey, tagValuePrefix, delimiter, maxTagValueSuffixes, deadline) return s.idb().SearchTagValueSuffixes(qt, accountID, projectID, tr, tagKey, tagValuePrefix, delimiter, maxTagValueSuffixes, deadline)
} }
@ -2105,7 +2108,7 @@ func (s *Storage) updatePerDateData(rows []rawRow, mrs []*MetricRow) error {
sort.Slice(pendingDateMetricIDs, func(i, j int) bool { sort.Slice(pendingDateMetricIDs, func(i, j int) bool {
a := pendingDateMetricIDs[i] a := pendingDateMetricIDs[i]
b := pendingDateMetricIDs[j] b := pendingDateMetricIDs[j]
if a.accountID != b.projectID { if a.accountID != b.accountID {
return a.accountID < b.accountID return a.accountID < b.accountID
} }
if a.projectID != b.projectID { if a.projectID != b.projectID {