Skip to content

Commit

Permalink
grcp_server: return err if cluster id is not ready . (tikv#5412) (tik…
Browse files Browse the repository at this point in the history
…v#5425)

close tikv#5411, ref tikv#5412

Signed-off-by: bufferflies <[email protected]>

Co-authored-by: bufferflies <[email protected]>
  • 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.