From 5b7f40907e4abd508b7ef61f4e94452902e3adbe Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin <valyala@victoriametrics.com> Date: Tue, 14 Nov 2023 19:57:29 +0100 Subject: [PATCH] app/vmselect/netstorage: do not retry request when deadline is exceeded --- app/vmselect/netstorage/netstorage.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/vmselect/netstorage/netstorage.go b/app/vmselect/netstorage/netstorage.go index 47e058b32e..90a8140d3c 100644 --- a/app/vmselect/netstorage/netstorage.go +++ b/app/vmselect/netstorage/netstorage.go @@ -1619,7 +1619,7 @@ func processBlocks(qt *querytracer.Tracer, sns []*storageNode, denyPartialRespon // Make sure that processBlock is no longer called after the exit from processBlocks() function. // Use per-worker WaitGroup instead of a shared WaitGroup in order to avoid inter-CPU contention, - // which may siginificantly slow down the rate of processBlock calls on multi-CPU systems. + // which may significantly slow down the rate of processBlock calls on multi-CPU systems. type wgStruct struct { // mu prevents from calling processBlock when stop is set to true mu sync.Mutex @@ -2060,8 +2060,12 @@ func (sn *storageNode) execOnConnWithPossibleRetry(qt *querytracer.Tracer, funcN } var er *errRemote var ne net.Error - if errors.As(err, &er) || errors.As(err, &ne) && ne.Timeout() { - // There is no sense in repeating the query on errors induced by vmstorage (errRemote) or on network timeout errors. + if errors.As(err, &er) || errors.As(err, &ne) && ne.Timeout() || deadline.Exceeded() { + // There is no sense in repeating the query on the following errors: + // + // - induced by vmstorage (errRemote) + // - network timeout errors + // - request deadline exceeded errors return err } // Repeat the query in the hope the error was temporary.