Skip to content

Commit

Permalink
Allow setting cluster Id explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
feedmeapples committed Feb 2, 2023
1 parent dbeab31 commit 176c593
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions common/cluster/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ type (
InitialFailoverVersion int64 `yaml:"initialFailoverVersion"`
// Address indicate the remote service address(Host:Port). Host can be DNS name.
RPCAddress string `yaml:"rpcAddress"`
<<<<<<< Updated upstream
ShardCount int32 `yaml:"-"` // Ignore this field when loading config.
=======
// Cluster ID allows to explicitly the ID of the cluster. Optional.
ClusterID string `yaml:"clusterId"`
>>>>>>> Stashed changes
// private field to track cluster information updates
version int64
}
Expand Down
11 changes: 10 additions & 1 deletion temporal/fx.go
Original file line number Diff line number Diff line change
Expand Up @@ -662,11 +662,20 @@ func ApplyClusterMetadataConfigProvider(
tag.Key("clusterInformation"),
tag.ClusterName(clusterName),
tag.IgnoredValue(clusterInfo))

// Only configure current cluster metadata from static config file
continue
}

// Only configure current cluster metadata from static config file
clusterId := uuid.New()
if clusterInfo.ClusterID != "" {
if uuid.Parse(clusterInfo.ClusterID) == nil {
return config.ClusterMetadata, config.Persistence, fmt.Errorf("invalid cluster id: %v", clusterInfo.ClusterID)
}

clusterId = clusterInfo.ClusterID
}

applied, err := clusterMetadataManager.SaveClusterMetadata(
ctx,
&persistence.SaveClusterMetadataRequest{
Expand Down

0 comments on commit 176c593

Please sign in to comment.