From a2d01bd5a32efc58381a27c713bf467c8b0f091f Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Thu, 7 Sep 2023 16:29:57 +0800 Subject: [PATCH] add log Signed-off-by: Ryan Leung --- pkg/mcs/scheduling/server/grpc_service.go | 7 ++++++- tests/integrations/mcs/scheduling/server_test.go | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/mcs/scheduling/server/grpc_service.go b/pkg/mcs/scheduling/server/grpc_service.go index ed7e0b73d9da..f3763d0b7221 100644 --- a/pkg/mcs/scheduling/server/grpc_service.go +++ b/pkg/mcs/scheduling/server/grpc_service.go @@ -24,6 +24,7 @@ import ( "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/mcs/registry" "github.com/tikv/pd/pkg/utils/apiutil" + "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -72,11 +73,14 @@ func (s *Service) StoreHeartbeat(ctx context.Context, request *schedulingpb.Stor c := s.GetCluster() if c == nil { // TODO: add metrics + log.Info("cluster isn't initialized") return &schedulingpb.StoreHeartbeatResponse{Header: &schedulingpb.ResponseHeader{ClusterId: s.clusterID}}, nil } // TODO: add metrics - c.HandleStoreHeartbeat(request) + if err := c.HandleStoreHeartbeat(request); err != nil { + log.Error("handle store heartbeat failed", zap.Error(err)) + } return &schedulingpb.StoreHeartbeatResponse{Header: &schedulingpb.ResponseHeader{ClusterId: s.clusterID}}, nil } @@ -85,6 +89,7 @@ func (s *Service) PutStore(ctx context.Context, request *schedulingpb.PutStoreRe c := s.GetCluster() if c == nil { // TODO: add metrics + log.Info("cluster isn't initialized") return &schedulingpb.PutStoreResponse{Header: &schedulingpb.ResponseHeader{ClusterId: s.clusterID}}, nil } diff --git a/tests/integrations/mcs/scheduling/server_test.go b/tests/integrations/mcs/scheduling/server_test.go index b0824f1f93c6..2c9ae476f434 100644 --- a/tests/integrations/mcs/scheduling/server_test.go +++ b/tests/integrations/mcs/scheduling/server_test.go @@ -99,7 +99,7 @@ func (suite *serverTestSuite) TestAllocIDAfterLeaderChange() { re.NoError(failpoint.Disable("github.com/tikv/pd/pkg/mcs/scheduling/server/fastUpdateMember")) } -func (suite *serverTestSuite) TestForwardSchedulingRelated() { +func (suite *serverTestSuite) TestForwardStoreHeartbeat() { re := suite.Require() tc, err := tests.NewTestSchedulingCluster(suite.ctx, 1, suite.backendEndpoints) re.NoError(err)