MCPcopy Create free account
hub / github.com/apache/kvrocks-controller / syncClusterToNodes

Method syncClusterToNodes

controller/cluster.go:183–208  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

181}
182
183func (c *ClusterChecker) syncClusterToNodes(ctx context.Context) error {
184 clusterInfo, err := c.clusterStore.GetCluster(ctx, c.namespace, c.clusterName)
185 if err != nil {
186 return err
187 }
188 version := clusterInfo.Version.Load()
189 for _, shard := range clusterInfo.Shards {
190 for _, node := range shard.Nodes {
191 go func(n store.Node) {
192 log := logger.Get().With(
193 zap.String("namespace", c.namespace),
194 zap.String("cluster", c.clusterName),
195 zap.Int64("version", version),
196 zap.String("node_id", n.ID()),
197 zap.String("addr", n.Addr()))
198 // sync the clusterName to the latest version
199 if err := n.SyncClusterInfo(ctx, clusterInfo); err != nil {
200 log.Error("Failed to sync the cluster topology to the node", zap.Error(err))
201 } else {
202 log.Info("Succeed to sync the cluster topology to the node")
203 }
204 }(node)
205 }
206 }
207 return nil
208}
209
210func (c *ClusterChecker) parallelProbeNodes(ctx context.Context, cluster *store.Cluster) {
211 var mu sync.Mutex

Callers 1

probeLoopMethod · 0.95

Calls 8

GetFunction · 0.92
ErrorMethod · 0.80
InfoMethod · 0.80
GetClusterMethod · 0.65
IDMethod · 0.65
AddrMethod · 0.65
SyncClusterInfoMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected