diff --git a/internal/locate/region_request.go b/internal/locate/region_request.go index e30ecf0e09..3f3fa396c4 100644 --- a/internal/locate/region_request.go +++ b/internal/locate/region_request.go @@ -1432,6 +1432,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" } @@ -1440,6 +1442,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) { @@ -1735,6 +1741,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),