Skip to content

Commit

Permalink
refine region request debug log (#1406)
Browse files Browse the repository at this point in the history
Signed-off-by: crazycs520 <[email protected]>
  • Loading branch information
crazycs520 authored Aug 8, 2024
1 parent 50d9718 commit 53cb1b6
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 @@ -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{}})
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand All @@ -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 {
Expand Down

0 comments on commit 53cb1b6

Please sign in to comment.