Skip to content

Commit

Permalink
grcp_server: return err if cluster id is not ready . (#5412) (#5425)
Browse files Browse the repository at this point in the history
close #5411, ref #5412

Signed-off-by: bufferflies <1045931706@qq.com>

Co-authored-by: bufferflies <1045931706@qq.com>
  • Loading branch information
ti-chi-bot and bufferflies authored Aug 16, 2022
1 parent c91d5ca commit 4ab9c0e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions server/grpc_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1490,6 +1490,12 @@ func (s *GrpcServer) validateRequest(header *pdpb.RequestHeader) error {
}

func (s *GrpcServer) header() *pdpb.ResponseHeader {
if s.clusterID == 0 {
return s.errorHeader(&pdpb.Error{
Type: pdpb.ErrorType_NOT_BOOTSTRAPPED,
Message: "cluster id is not ready",
})
}
return &pdpb.ResponseHeader{ClusterId: s.clusterID}
}

Expand Down

0 comments on commit 4ab9c0e

Please sign in to comment.