From 8f682a1523f255c81adf69e77db1c7e030ff81a7 Mon Sep 17 00:00:00 2001 From: ekexium Date: Tue, 3 Dec 2024 18:49:10 +0800 Subject: [PATCH 1/2] handle error invalid_max_ts_update Signed-off-by: ekexium --- internal/locate/region_request.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/locate/region_request.go b/internal/locate/region_request.go index e30ecf0e0..4e7f01c21 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,10 @@ func (s *RegionRequestSender) onRegionError( return false, nil } + if isInvalidMaxTsUpdate(regionErr) { + return false, errors.New(regionErr.String()) + } + logutil.Logger(bo.GetCtx()).Debug( "tikv reports region failed", zap.Stringer("regionErr", regionErr), From e5cef904c7d32bdc30cbf70f8a96ccf98fbe6fb6 Mon Sep 17 00:00:00 2001 From: ekexium Date: Thu, 12 Dec 2024 18:44:36 +0800 Subject: [PATCH 2/2] log more info Signed-off-by: ekexium --- internal/locate/region_request.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/locate/region_request.go b/internal/locate/region_request.go index 4e7f01c21..3f3fa396c 100644 --- a/internal/locate/region_request.go +++ b/internal/locate/region_request.go @@ -1742,6 +1742,12 @@ func (s *RegionRequestSender) onRegionError( } 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()) }