(ctx context.Context)
| 181 | } |
| 182 | |
| 183 | func (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 | |
| 210 | func (c *ClusterChecker) parallelProbeNodes(ctx context.Context, cluster *store.Cluster) { |
| 211 | var mu sync.Mutex |
no test coverage detected