Skip to content

Commit

Permalink
Remove DefaultVisibilityIndexName from history config (temporalio#4189)
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigozhou authored and samanbarghi committed May 2, 2023
1 parent f9d0936 commit 2f26910
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 27 deletions.
8 changes: 3 additions & 5 deletions service/history/configs/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ import (

// Config represents configuration for history service
type Config struct {
NumberOfShards int32
DefaultVisibilityIndexName string
NumberOfShards int32

EnableReplicationStream dynamicconfig.BoolPropertyFn

Expand Down Expand Up @@ -306,10 +305,9 @@ const (
)

// NewConfig returns new service config with default values
func NewConfig(dc *dynamicconfig.Collection, numberOfShards int32, isAdvancedVisibilityConfigExist bool, defaultVisibilityIndex string) *Config {
func NewConfig(dc *dynamicconfig.Collection, numberOfShards int32, isAdvancedVisibilityConfigExist bool) *Config {
cfg := &Config{
NumberOfShards: numberOfShards,
DefaultVisibilityIndexName: defaultVisibilityIndex,
NumberOfShards: numberOfShards,

EnableReplicationStream: dc.GetBoolProperty(dynamicconfig.EnableReplicationStream, false),

Expand Down
16 changes: 0 additions & 16 deletions service/history/fx.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ import (
"go.temporal.io/server/common/metrics"
"go.temporal.io/server/common/namespace"
persistenceClient "go.temporal.io/server/common/persistence/client"
"go.temporal.io/server/common/persistence/sql/sqlplugin/mysql"
"go.temporal.io/server/common/persistence/sql/sqlplugin/postgresql"
"go.temporal.io/server/common/persistence/sql/sqlplugin/sqlite"
"go.temporal.io/server/common/persistence/visibility"
"go.temporal.io/server/common/persistence/visibility/manager"
"go.temporal.io/server/common/persistence/visibility/store/elasticsearch"
Expand Down Expand Up @@ -167,22 +164,9 @@ func ConfigProvider(
persistenceConfig config.Persistence,
esConfig *esclient.Config,
) *configs.Config {
indexName := ""
if persistenceConfig.StandardVisibilityConfigExist() {
storeConfig := persistenceConfig.DataStores[persistenceConfig.VisibilityStore]
if storeConfig.SQL != nil {
switch storeConfig.SQL.PluginName {
case mysql.PluginNameV8, postgresql.PluginNameV12, sqlite.PluginName:
indexName = storeConfig.SQL.DatabaseName
}
}
} else if persistenceConfig.AdvancedVisibilityConfigExist() {
indexName = esConfig.GetVisibilityIndex()
}
return configs.NewConfig(dc,
persistenceConfig.NumHistoryShards,
persistenceConfig.AdvancedVisibilityConfigExist(),
indexName,
)
}

Expand Down
2 changes: 1 addition & 1 deletion service/history/historyEngine.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func NewEngineWithShardContext(
config.SearchAttributesNumberOfKeysLimit,
config.SearchAttributesSizeOfValueLimit,
config.SearchAttributesTotalSizeLimit,
config.DefaultVisibilityIndexName,
persistenceVisibilityMgr.GetIndexName(),
visibility.AllowListForValidation(persistenceVisibilityMgr.GetStoreNames()),
)

Expand Down
2 changes: 1 addition & 1 deletion service/history/historyEngine2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func (s *engine2Suite) SetupTest() {
s.config.SearchAttributesNumberOfKeysLimit,
s.config.SearchAttributesSizeOfValueLimit,
s.config.SearchAttributesTotalSizeLimit,
s.config.DefaultVisibilityIndexName,
"",
false,
),
workflowConsistencyChecker: api.NewWorkflowConsistencyChecker(mockShard, s.workflowCache),
Expand Down
1 change: 0 additions & 1 deletion service/history/queue_factory_base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ func getModuleDependencies(controller *gomock.Controller, c *moduleTestCase) fx.
dynamicconfig.NewNoopCollection(),
1,
false,
"",
)
archivalMetadata := getArchivalMetadata(controller, c)
clusterMetadata := cluster.NewMockMetadata(controller)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ func (s *streamReceiverMonitorSuite) SetupTest() {
dynamicconfig.NewNoopCollection(),
1,
false,
"",
),
ClientBean: s.clientBean,
MetricsHandler: metrics.NoopMetricsHandler,
Expand Down
2 changes: 1 addition & 1 deletion service/history/tests/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ var (

func NewDynamicConfig() *configs.Config {
dc := dynamicconfig.NewNoopCollection()
config := configs.NewConfig(dc, 1, false, "")
config := configs.NewConfig(dc, 1, false)
// reduce the duration of long poll to increase test speed
config.LongPollExpirationInterval = dc.GetDurationPropertyFilteredByNamespace(dynamicconfig.HistoryLongPollExpirationInterval, 10*time.Second)
config.EnableActivityEagerExecution = dynamicconfig.GetBoolPropertyFnFilteredByNamespace(true)
Expand Down
2 changes: 1 addition & 1 deletion service/history/workflowTaskHandlerCallbacks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (s *WorkflowTaskHandlerCallbackSuite) SetupTest() {
config.SearchAttributesNumberOfKeysLimit,
config.SearchAttributesSizeOfValueLimit,
config.SearchAttributesTotalSizeLimit,
config.DefaultVisibilityIndexName,
"",
false,
),
workflowConsistencyChecker: api.NewWorkflowConsistencyChecker(mockShard, workflowCache),
Expand Down

0 comments on commit 2f26910

Please sign in to comment.