From c1de3f67b4a1c8b25ad70a41e9c5714c260d78d5 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Wed, 15 Apr 2020 00:05:01 +0300 Subject: [PATCH] lib/storage: skip metricID if the corresponding metricID->metricName is missing in inverted index during search This case is possible when the corresponding metricID->metricName entry didn't propagate to inverted index yet. This should fix the following error: error when searching tsids for tfss [...]: cannot find metricName by metricID 1582417212213420669: EOF --- lib/storage/index_db.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/storage/index_db.go b/lib/storage/index_db.go index efbd4266a4..bc1f9006c4 100644 --- a/lib/storage/index_db.go +++ b/lib/storage/index_db.go @@ -1362,6 +1362,11 @@ func (is *indexSearch) updateMetricIDsByMetricNameMatch(metricIDs, srcMetricIDs var err error metricName.B, err = is.searchMetricName(metricName.B[:0], metricID) if err != nil { + if err == io.EOF { + // It is likely the metricID->metricName entry didn't propagate to inverted index yet. + // Skip this metricID for now. + continue + } return fmt.Errorf("cannot find metricName by metricID %d: %s", metricID, err) } if err := mn.Unmarshal(metricName.B); err != nil {