From 53cb1b65b8ccba665d342187cf23d0d51d6e4ac5 Mon Sep 17 00:00:00 2001 From: crazycs Date: Thu, 8 Aug 2024 11:02:45 +0800 Subject: [PATCH] refine region request debug log (#1406) Signed-off-by: crazycs520 --- internal/locate/region_request.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/locate/region_request.go b/internal/locate/region_request.go index 21b12f4aa3..433aa73547 100644 --- a/internal/locate/region_request.go +++ b/internal/locate/region_request.go @@ -1482,7 +1482,7 @@ func (s *RegionRequestSender) SendReqCtx( // TODO: Change the returned error to something like "region missing in cache", // and handle this error like EpochNotMatch, which means to re-split the request and retry. - if cost := time.Since(startTime); cost > slowLogSendReqTime || cost > timeout { + if cost := time.Since(startTime); cost > slowLogSendReqTime || cost > timeout || bo.GetTotalSleep() > 1000 { s.logSendReqError(bo, "throwing pseudo region error due to no replica available", regionID, tryTimes, req, cost, bo.GetTotalSleep()-startBackOff, timeout) } resp, err = tikvrpc.GenRegionErrorResp(req, &errorpb.Error{EpochNotMatch: &errorpb.EpochNotMatch{}}) @@ -1519,7 +1519,7 @@ func (s *RegionRequestSender) SendReqCtx( resp, retry, err = s.sendReqToRegion(bo, rpcCtx, req, timeout) req.IsRetryRequest = true if err != nil { - if cost := time.Since(startTime); cost > slowLogSendReqTime || cost > timeout { + if cost := time.Since(startTime); cost > slowLogSendReqTime || cost > timeout || bo.GetTotalSleep() > 1000 { msg := fmt.Sprintf("send request failed, err: %v", err.Error()) s.logSendReqError(bo, msg, regionID, tryTimes, req, cost, bo.GetTotalSleep()-startBackOff, timeout) } @@ -1556,7 +1556,7 @@ func (s *RegionRequestSender) SendReqCtx( if regionErr != nil { retry, err = s.onRegionError(bo, rpcCtx, req, regionErr) if err != nil { - if cost := time.Since(startTime); cost > slowLogSendReqTime || cost > timeout { + if cost := time.Since(startTime); cost > slowLogSendReqTime || cost > timeout || bo.GetTotalSleep() > 1000 { msg := fmt.Sprintf("send request on region error failed, err: %v", err.Error()) s.logSendReqError(bo, msg, regionID, tryTimes, req, cost, bo.GetTotalSleep()-startBackOff, timeout) } @@ -1566,7 +1566,7 @@ func (s *RegionRequestSender) SendReqCtx( tryTimes++ continue } - if cost := time.Since(startTime); cost > slowLogSendReqTime || cost > timeout { + if cost := time.Since(startTime); cost > slowLogSendReqTime || cost > timeout || bo.GetTotalSleep() > 1000 { s.logSendReqError(bo, "send request meet region error without retry", regionID, tryTimes, req, cost, bo.GetTotalSleep()-startBackOff, timeout) } } else {