Skip to content

Commit

Permalink
refine region request debug log (#1408)
Browse files Browse the repository at this point in the history
Signed-off-by: crazycs520 <[email protected]>
  • Loading branch information
crazycs520 authored and ekexium committed Jul 31, 2024
1 parent befdef3 commit cd9141f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/locate/region_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ func (s *RegionRequestSender) SendReqCtx(
if err := s.replicaSelector.backoffOnNoCandidate(bo); err != nil {
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)
}
}
Expand Down Expand Up @@ -870,7 +870,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, retryTimes, req, cost, bo.GetTotalSleep()-startBackOff, timeout)
}
Expand Down Expand Up @@ -906,7 +906,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, retryTimes, req, cost, bo.GetTotalSleep()-startBackOff, timeout)
}
Expand All @@ -916,7 +916,7 @@ func (s *RegionRequestSender) SendReqCtx(
retryTimes++
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)
}
} else {
Expand Down

0 comments on commit cd9141f

Please sign in to comment.