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

The error of forwarding TSO should be handled #7320

Closed
rleungx opened this issue Nov 6, 2023 · 1 comment · Fixed by #7321 or #7327
Closed

The error of forwarding TSO should be handled #7320

rleungx opened this issue Nov 6, 2023 · 1 comment · Fixed by #7321 or #7327
Labels
severity/minor type/bug The issue is confirmed as a bug.

Comments

@rleungx
Copy link
Member

rleungx commented Nov 6, 2023

Bug Report

pd/server/grpc_service.go

Lines 2626 to 2653 in ab8bf7b

for i := 0; i < maxRetryTimesRequestTSOServer; i++ {
forwardedHost, ok := s.GetServicePrimaryAddr(ctx, utils.TSOServiceName)
if !ok || forwardedHost == "" {
return pdpb.Timestamp{}, ErrNotFoundTSOAddr
}
forwardStream, err = s.getTSOForwardStream(forwardedHost)
if err != nil {
return pdpb.Timestamp{}, err
}
forwardStream.Send(request)
ts, err = forwardStream.Recv()
if err != nil {
if strings.Contains(err.Error(), errs.NotLeaderErr) {
s.tsoPrimaryWatcher.ForceLoad()
time.Sleep(retryIntervalRequestTSOServer)
continue
}
if strings.Contains(err.Error(), codes.Unavailable.String()) {
s.tsoClientPool.Lock()
delete(s.tsoClientPool.clients, forwardedHost)
s.tsoClientPool.Unlock()
continue
}
log.Error("get global tso from tso service primary addr failed", zap.Error(err), zap.String("tso-addr", forwardedHost))
return pdpb.Timestamp{}, err
}
return *ts.GetTimestamp(), nil
}

forwardStream.Send(request)

The error of sending the request is not properly handled. We should do the error handling in case there is something wrong when forwarding the request to get TSO.

@rleungx rleungx added the type/bug The issue is confirmed as a bug. label Nov 6, 2023
@rleungx
Copy link
Member Author

rleungx commented Nov 6, 2023

/cc @lhy1024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/minor type/bug The issue is confirmed as a bug.
Projects
Development

Successfully merging a pull request may close this issue.

2 participants