Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle error invalid_max_ts_update #1512

Merged
merged 2 commits into from
Jan 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions internal/locate/region_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand All @@ -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) {
Expand Down Expand Up @@ -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),
Expand Down
Loading