Skip to content

Commit cf4dd1c

Browse files
authored
fix:修复查询配置文件分组列表不显示文件数量 (#1231)
1 parent 6c52a06 commit cf4dd1c

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

apiserver/xdsserverv3/resource/node.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ func (x *XDSNodeManager) ListSidecarNodes() []*XDSClient {
159159
// ID id 的格式是 ${sidecar|gateway}~namespace/uuid~hostIp
160160
// case 1: envoy 为 sidecar 模式时,则 NodeID 的格式为以下两种
161161
//
162-
// eg 1. namespace/uuid~hostIp
163-
// eg 2. sidecar~namespace/uuid-hostIp
164-
// eg 3. envoy_node_id="${NAMESPACE}/${INSTANCE_IP}~${POD_NAME}"
162+
// eg 1. namespace/uuid~hostIp
163+
// eg 2. sidecar~namespace/uuid-hostIp
164+
// eg 3. envoy_node_id="${NAMESPACE}/${INSTANCE_IP}~${POD_NAME}"
165165
//
166166
// case 2: envoy 为 gateway 模式时,则 NodeID 的格式为: gateway~namespace/uuid~hostIp
167167
func (PolarisNodeHash) ID(node *core.Node) string {

config/config_file_group.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
apiconfig "github.com/polarismesh/specification/source/go/api/v1/config_manage"
2626
apimodel "github.com/polarismesh/specification/source/go/api/v1/model"
2727
"go.uber.org/zap"
28+
"google.golang.org/protobuf/types/known/wrapperspb"
2829

2930
cachetypes "github.com/polarismesh/polaris/cache/api"
3031
api "github.com/polarismesh/polaris/common/api/v1"
@@ -276,7 +277,14 @@ func (s *Server) QueryConfigFileGroups(ctx context.Context,
276277
}
277278
values := make([]*apiconfig.ConfigFileGroup, 0, len(ret))
278279
for i := range ret {
279-
values = append(values, model.ToConfigGroupAPI(ret[i]))
280+
item := model.ToConfigGroupAPI(ret[i])
281+
fileCount, err := s.storage.CountConfigFiles(ret[i].Namespace, ret[i].Name)
282+
if err != nil {
283+
log.Error("[Config][Service] get config file count for group error.", utils.RequestID(ctx),
284+
utils.ZapNamespace(ret[i].Namespace), utils.ZapGroup(ret[i].Name), zap.Error(err))
285+
}
286+
item.FileCount = wrapperspb.UInt64(fileCount)
287+
values = append(values, item)
280288
}
281289

282290
resp := api.NewConfigBatchQueryResponse(apimodel.Code_ExecuteSuccess)

store/mysql/admin.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ func (le *leaderElectionStateMachine) tick() {
252252
log.Errorf("[Store][database] leader heartbeat err (%v), change to follower state (%s)", err, le.electKey)
253253
}
254254
if !success && err == nil {
255-
log.Errorf("[Store][database] leader heartbeat abort, change to follower state (%s)", le.electKey)
255+
log.Infof("[Store][database] leader heartbeat abort, change to follower state (%s)", le.electKey)
256256
}
257257
}
258258
leader, dead, err := le.checkLeaderDead()

0 commit comments

Comments
 (0)