Skip to content

Commit

Permalink
Favor local config value on enable global namespace (#2368)
Browse files Browse the repository at this point in the history
* Favor config value in enable global namespace

* Add comment

* Update cluster metadata info if enable namespace changed
  • Loading branch information
yux0 authored Jan 12, 2022
1 parent f3780d0 commit 434ec0e
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions temporal/fx.go
Original file line number Diff line number Diff line change
Expand Up @@ -603,14 +603,6 @@ func ApplyClusterMetadataConfigProvider(
tag.Value(persistedShardCount))
config.Persistence.NumHistoryShards = persistedShardCount
}
if resp.IsGlobalNamespaceEnabled != clusterData.EnableGlobalNamespace {
logger.Warn(
mismatchLogMessage,
tag.Key("clusterMetadata.EnableGlobalNamespace"),
tag.IgnoredValue(clusterData.EnableGlobalNamespace),
tag.Value(resp.IsGlobalNamespaceEnabled))
config.ClusterMetadata.EnableGlobalNamespace = resp.IsGlobalNamespaceEnabled
}
if resp.FailoverVersionIncrement != clusterData.FailoverVersionIncrement {
logger.Warn(
mismatchLogMessage,
Expand All @@ -619,6 +611,25 @@ func ApplyClusterMetadataConfigProvider(
tag.Value(resp.FailoverVersionIncrement))
config.ClusterMetadata.FailoverVersionIncrement = resp.FailoverVersionIncrement
}
if resp.IsGlobalNamespaceEnabled != clusterData.EnableGlobalNamespace {
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,
})
if !applied || err != nil {
return config.ClusterMetadata, config.Persistence, fmt.Errorf("error while updating cluster metadata: %w", err)
}
}
}
err = loadClusterInformationFromStore(config, clusterMetadataManager, logger)
if err != nil {
Expand Down

0 comments on commit 434ec0e

Please sign in to comment.