diff --git a/server/grpc_service.go b/server/grpc_service.go index a0941264c07..01d7f441c9c 100644 --- a/server/grpc_service.go +++ b/server/grpc_service.go @@ -2363,6 +2363,10 @@ func (s *GrpcServer) WatchGlobalConfig(req *pdpb.WatchGlobalConfigRequest, serve // - If required revision < CompactRevision, we need to reload all configs to avoid losing data. // - If required revision >= CompactRevision, just keep watching. // Use WithPrevKV() to get the previous key-value pair when get Delete Event. + if s.client == nil { + log.Warn("WatchGlobalConfig panic, etcd client is nil") + //return errors.New("etcd client is nil") + } watchChan := s.client.Watch(ctx, configPath, clientv3.WithPrefix(), clientv3.WithRev(revision), clientv3.WithPrevKV()) for { select { diff --git a/server/server.go b/server/server.go index bb52bdb7898..ade375df702 100644 --- a/server/server.go +++ b/server/server.go @@ -339,6 +339,7 @@ func (s *Server) startEtcd(ctx context.Context) error { } // start client + log.Info("start init etcd client") s.client, s.httpClient, err = s.startClient() if err != nil { return err