refine region request debug log (#1408)

Signed-off-by: crazycs520 <crazycs520@gmail.com>
This commit is contained in:
crazycs 2024-07-31 17:42:29 +08:00 committed by GitHub
parent 3ac46e8171
commit eec8198343
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 4 deletions

View File

@ -829,7 +829,7 @@ func (s *RegionRequestSender) SendReqCtx(
if err := s.replicaSelector.backoffOnNoCandidate(bo); err != nil { if err := s.replicaSelector.backoffOnNoCandidate(bo); err != nil {
return nil, nil, retryTimes, err return nil, nil, retryTimes, err
} }
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, retryTimes, req, cost, bo.GetTotalSleep()-startBackOff, timeout) s.logSendReqError(bo, "throwing pseudo region error due to no replica available", regionID, retryTimes, req, cost, bo.GetTotalSleep()-startBackOff, timeout)
} }
} }
@ -870,7 +870,7 @@ func (s *RegionRequestSender) SendReqCtx(
resp, retry, err = s.sendReqToRegion(bo, rpcCtx, req, timeout) resp, retry, err = s.sendReqToRegion(bo, rpcCtx, req, timeout)
req.IsRetryRequest = true req.IsRetryRequest = true
if err != nil { 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()) msg := fmt.Sprintf("send request failed, err: %v", err.Error())
s.logSendReqError(bo, msg, regionID, retryTimes, req, cost, bo.GetTotalSleep()-startBackOff, timeout) s.logSendReqError(bo, msg, regionID, retryTimes, req, cost, bo.GetTotalSleep()-startBackOff, timeout)
} }
@ -906,7 +906,7 @@ func (s *RegionRequestSender) SendReqCtx(
if regionErr != nil { if regionErr != nil {
retry, err = s.onRegionError(bo, rpcCtx, req, regionErr) retry, err = s.onRegionError(bo, rpcCtx, req, regionErr)
if err != nil { 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()) msg := fmt.Sprintf("send request on region error failed, err: %v", err.Error())
s.logSendReqError(bo, msg, regionID, retryTimes, req, cost, bo.GetTotalSleep()-startBackOff, timeout) s.logSendReqError(bo, msg, regionID, retryTimes, req, cost, bo.GetTotalSleep()-startBackOff, timeout)
} }
@ -916,7 +916,7 @@ func (s *RegionRequestSender) SendReqCtx(
retryTimes++ retryTimes++
continue 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, retryTimes, req, cost, bo.GetTotalSleep()-startBackOff, timeout) s.logSendReqError(bo, "send request meet region error without retry", regionID, retryTimes, req, cost, bo.GetTotalSleep()-startBackOff, timeout)
} }
} else { } else {