From cf4dd1cc168e6437526c1e6df07412c247bce30b Mon Sep 17 00:00:00 2001 From: liaochuntao Date: Sun, 3 Sep 2023 00:27:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E5=88=86=E7=BB=84=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E4=B8=8D=E6=98=BE=E7=A4=BA=E6=96=87=E4=BB=B6=E6=95=B0?= =?UTF-8?q?=E9=87=8F=20(#1231)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apiserver/xdsserverv3/resource/node.go | 6 +++--- config/config_file_group.go | 10 +++++++++- store/mysql/admin.go | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/apiserver/xdsserverv3/resource/node.go b/apiserver/xdsserverv3/resource/node.go index e7d74244e..5d1d64bb1 100644 --- a/apiserver/xdsserverv3/resource/node.go +++ b/apiserver/xdsserverv3/resource/node.go @@ -159,9 +159,9 @@ func (x *XDSNodeManager) ListSidecarNodes() []*XDSClient { // ID id 的格式是 ${sidecar|gateway}~namespace/uuid~hostIp // case 1: envoy 为 sidecar 模式时,则 NodeID 的格式为以下两种 // -// eg 1. namespace/uuid~hostIp -// eg 2. sidecar~namespace/uuid-hostIp -// eg 3. envoy_node_id="${NAMESPACE}/${INSTANCE_IP}~${POD_NAME}" +// eg 1. namespace/uuid~hostIp +// eg 2. sidecar~namespace/uuid-hostIp +// eg 3. envoy_node_id="${NAMESPACE}/${INSTANCE_IP}~${POD_NAME}" // // case 2: envoy 为 gateway 模式时,则 NodeID 的格式为: gateway~namespace/uuid~hostIp func (PolarisNodeHash) ID(node *core.Node) string { diff --git a/config/config_file_group.go b/config/config_file_group.go index ae6541560..b252cdb8a 100644 --- a/config/config_file_group.go +++ b/config/config_file_group.go @@ -25,6 +25,7 @@ import ( apiconfig "github.com/polarismesh/specification/source/go/api/v1/config_manage" apimodel "github.com/polarismesh/specification/source/go/api/v1/model" "go.uber.org/zap" + "google.golang.org/protobuf/types/known/wrapperspb" cachetypes "github.com/polarismesh/polaris/cache/api" api "github.com/polarismesh/polaris/common/api/v1" @@ -276,7 +277,14 @@ func (s *Server) QueryConfigFileGroups(ctx context.Context, } values := make([]*apiconfig.ConfigFileGroup, 0, len(ret)) for i := range ret { - values = append(values, model.ToConfigGroupAPI(ret[i])) + item := model.ToConfigGroupAPI(ret[i]) + fileCount, err := s.storage.CountConfigFiles(ret[i].Namespace, ret[i].Name) + if err != nil { + log.Error("[Config][Service] get config file count for group error.", utils.RequestID(ctx), + utils.ZapNamespace(ret[i].Namespace), utils.ZapGroup(ret[i].Name), zap.Error(err)) + } + item.FileCount = wrapperspb.UInt64(fileCount) + values = append(values, item) } resp := api.NewConfigBatchQueryResponse(apimodel.Code_ExecuteSuccess) diff --git a/store/mysql/admin.go b/store/mysql/admin.go index 53b5cdfbe..f491f736b 100644 --- a/store/mysql/admin.go +++ b/store/mysql/admin.go @@ -252,7 +252,7 @@ func (le *leaderElectionStateMachine) tick() { log.Errorf("[Store][database] leader heartbeat err (%v), change to follower state (%s)", err, le.electKey) } if !success && err == nil { - log.Errorf("[Store][database] leader heartbeat abort, change to follower state (%s)", le.electKey) + log.Infof("[Store][database] leader heartbeat abort, change to follower state (%s)", le.electKey) } } leader, dead, err := le.checkLeaderDead()