From ea038a89403e94ce7955ac25e432d45bf74a55ab Mon Sep 17 00:00:00 2001
From: Nikolay <nik@victoriametrics.com>
Date: Sun, 12 Mar 2023 08:29:43 +0100
Subject: [PATCH] lib/storage: correctly handle io.EOF error for pre-fetched
 metrics (#3946)

io.EOF shouldn't be returned from this function. It breaks all search
API logic and may result in empty query results.
---
 lib/storage/storage.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/storage/storage.go b/lib/storage/storage.go
index 5774ffe376..c74bec43eb 100644
--- a/lib/storage/storage.go
+++ b/lib/storage/storage.go
@@ -1238,7 +1238,7 @@ func (s *Storage) prefetchMetricNames(qt *querytracer.Tracer, accountID, project
 			}
 		}
 	})
-	if err != nil {
+	if err != nil && err != io.EOF {
 		return err
 	}
 	qt.Printf("pre-fetch metric names for %d metric ids", len(metricIDs))