Skip to content

Commit

Permalink
Handle error invalid_max_ts_update (#1512)
Browse files Browse the repository at this point in the history
ref tikv/tikv#17916

Signed-off-by: ekexium <[email protected]>
  • Loading branch information
ekexium authored Jan 7, 2025
1 parent 23abf0a commit 2eba2f6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions internal/locate/region_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -1433,6 +1433,8 @@ func regionErrorToLabel(e *errorpb.Error) string {
return "mismatch_peer_id"
} else if e.GetBucketVersionNotMatch() != nil {
return "bucket_version_not_match"
} else if isInvalidMaxTsUpdate(e) {
return "invalid_max_ts_update"
}
return "unknown"
}
Expand All @@ -1441,6 +1443,10 @@ func isDeadlineExceeded(e *errorpb.Error) bool {
return strings.Contains(e.GetMessage(), "Deadline is exceeded")
}

func isInvalidMaxTsUpdate(e *errorpb.Error) bool {
return strings.Contains(e.GetMessage(), "invalid max_ts update")
}

func (s *RegionRequestSender) onRegionError(
bo *retry.Backoffer, ctx *RPCContext, req *tikvrpc.Request, regionErr *errorpb.Error,
) (shouldRetry bool, err error) {
Expand Down Expand Up @@ -1736,6 +1742,16 @@ func (s *RegionRequestSender) onRegionError(
return false, nil
}

if isInvalidMaxTsUpdate(regionErr) {
logutil.Logger(bo.GetCtx()).Error(
"tikv reports `InvalidMaxTsUpdate`",
zap.String("message", regionErr.GetMessage()),
zap.Stringer("req", req),
zap.Stringer("ctx", ctx),
)
return false, errors.New(regionErr.String())
}

logutil.Logger(bo.GetCtx()).Debug(
"tikv reports region failed",
zap.Stringer("regionErr", regionErr),
Expand Down

0 comments on commit 2eba2f6

Please sign in to comment.