Skip to content

Commit

Permalink
Preserve the info when updating is_global_namepsace_enabled (#2540)
Browse files Browse the repository at this point in the history
  • Loading branch information
yux0 committed Feb 24, 2022
1 parent 4d129d1 commit 60e5a8b
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions temporal/fx.go
Expand Up @@ -625,22 +625,15 @@ func ApplyClusterMetadataConfigProvider(

// Allow updating cluster metadata if global namespace is disabled
if !resp.IsGlobalNamespaceEnabled && clusterData.EnableGlobalNamespace {
resp.InitialFailoverVersion = clusterInfo.InitialFailoverVersion
resp.FailoverVersionIncrement = clusterData.FailoverVersionIncrement
currentMetadata := resp.ClusterMetadata
currentMetadata.IsGlobalNamespaceEnabled = clusterData.EnableGlobalNamespace
currentMetadata.InitialFailoverVersion = clusterInfo.InitialFailoverVersion
currentMetadata.FailoverVersionIncrement = clusterData.FailoverVersionIncrement

applied, err = clusterMetadataManager.SaveClusterMetadata(
&persistence.SaveClusterMetadataRequest{
ClusterMetadata: persistencespb.ClusterMetadata{
HistoryShardCount: resp.HistoryShardCount,
ClusterName: resp.ClusterName,
ClusterId: resp.ClusterId,
ClusterAddress: resp.ClusterAddress,
FailoverVersionIncrement: resp.FailoverVersionIncrement,
InitialFailoverVersion: resp.InitialFailoverVersion,
IsGlobalNamespaceEnabled: clusterData.EnableGlobalNamespace,
IsConnectionEnabled: resp.IsConnectionEnabled,
},
Version: resp.Version,
ClusterMetadata: currentMetadata,
Version: resp.Version,
})
if !applied || err != nil {
return config.ClusterMetadata, config.Persistence, fmt.Errorf("error while updating cluster metadata: %w", err)
Expand Down

0 comments on commit 60e5a8b

Please sign in to comment.