From 5b41122292cce6083a96c48ed625c4989f9a6b9d Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Wed, 14 Aug 2019 02:12:42 +0300 Subject: [PATCH] lib/storage: properly cache tagFilters -> TSIDs entries from historical index --- lib/storage/index_db.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/storage/index_db.go b/lib/storage/index_db.go index 7d29aa702..35d4556d0 100644 --- a/lib/storage/index_db.go +++ b/lib/storage/index_db.go @@ -991,7 +991,8 @@ func (db *indexDB) searchTSIDs(tfss []*TagFilters, tr TimeRange, maxMetrics int) extTSIDs, err = is.searchTSIDs(tfss, tr, maxMetrics) extDB.putIndexSearch(is) - db.putToTagCache(tsids, tfKeyExtBuf.B) + sort.Slice(extTSIDs, func(i, j int) bool { return extTSIDs[i].Less(&extTSIDs[j]) }) + extDB.putToTagCache(extTSIDs, tfKeyExtBuf.B) }) { if err != nil { return nil, err