Skip to content

Commit

Permalink
fix:修复查询配置文件分组列表不显示文件数量 (#1231)
Browse files Browse the repository at this point in the history
  • Loading branch information
chuntaojun authored Sep 2, 2023
1 parent 6c52a06 commit cf4dd1c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
6 changes: 3 additions & 3 deletions apiserver/xdsserverv3/resource/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 9 additions & 1 deletion config/config_file_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion store/mysql/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit cf4dd1c

Please sign in to comment.