-
Notifications
You must be signed in to change notification settings - Fork 726
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
server: advance ServerStart check #8951
Changes from all commits
80a91af
7fd2521
2bd964d
e168226
9045323
0357ee1
650f562
6186e8c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -325,6 +325,9 @@ | |
// GetMinTSFromTSOService queries all tso servers and gets the minimum timestamp across | ||
// all keyspace groups. | ||
func (s *GrpcServer) GetMinTSFromTSOService() (*pdpb.Timestamp, error) { | ||
if s.IsClosed() { | ||
return nil, errs.ErrNotStarted | ||
} | ||
addrs := s.keyspaceGroupManager.GetTSOServiceAddrs() | ||
if len(addrs) == 0 { | ||
return &pdpb.Timestamp{}, errs.ErrGetMinTS.FastGenByArgs("no tso servers/pods discovered") | ||
|
@@ -536,6 +539,11 @@ | |
return errors.WithStack(err) | ||
} | ||
|
||
// TSO uses leader lease to determine validity. No need to check leader here. | ||
if s.IsClosed() { | ||
return errs.ErrNotStarted | ||
} | ||
|
||
forwardedHost := grpcutil.GetForwardedHost(stream.Context()) | ||
if !s.isLocalRequest(forwardedHost) { | ||
clientConn, err := s.getDelegateClient(s.ctx, forwardedHost) | ||
|
@@ -570,10 +578,6 @@ | |
} | ||
|
||
start := time.Now() | ||
// TSO uses leader lease to determine validity. No need to check leader here. | ||
if s.IsClosed() { | ||
return errs.ErrNotStarted | ||
} | ||
if clusterID := keypath.ClusterID(); request.GetHeader().GetClusterId() != clusterID { | ||
return errs.ErrMismatchClusterID(clusterID, request.GetHeader().GetClusterId()) | ||
} | ||
|
@@ -710,6 +714,9 @@ | |
return nil, errs.ErrGRPCRateLimitExceeded(err) | ||
} | ||
} | ||
if s.IsClosed() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe placing this check to the head of this function is better? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Other functions' checking There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
return nil, errs.ErrNotStarted | ||
} | ||
// recovering mark is stored in etcd directly, there's no need to forward. | ||
marked, err := s.Server.IsSnapshotRecovering(ctx) | ||
if err != nil { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about adding a test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added 2bd964d