Skip to content

Commit

Permalink
Enable Nexus by default (#7021)
Browse files Browse the repository at this point in the history
## What changed?

- Change the `system.enableNexus` dynamic config default to `true`.
- Remove test overrides for that dynamic config.
- Return false for Nexus enabled in `GetSystemInfo` if the HTTP server
is disabled.
  • Loading branch information
bergundy committed Dec 20, 2024
1 parent 7fabbab commit d07d0a5
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 24 deletions.
6 changes: 3 additions & 3 deletions common/dynamicconfig/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -861,9 +861,9 @@ and deployment interaction in matching and history.`,
)
EnableNexus = NewGlobalBoolSetting(
"system.enableNexus",
false,
`EnableNexus toggles all Nexus functionality on the server. Note that toggling this requires restarting
server hosts for it to take effect.`,
true,
`Toggles all Nexus functionality on the server. Note that toggling this requires restarting server hosts for it
to take effect.`,
)
RefreshNexusEndpointsLongPollTimeout = NewGlobalDurationSetting(
"system.refreshNexusEndpointsLongPollTimeout",
Expand Down
19 changes: 13 additions & 6 deletions service/frontend/fx.go
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,8 @@ func OperatorHandlerProvider(
}

func HandlerProvider(
cfg *config.Config,
serviceName primitives.ServiceName,
dcRedirectionPolicy config.DCRedirectionPolicy,
serviceConfig *Config,
versionChecker *VersionChecker,
Expand Down Expand Up @@ -733,6 +735,7 @@ func HandlerProvider(
membershipMonitor,
healthInterceptor,
scheduleSpecBuilder,
httpEnabled(cfg, serviceName),
)
return wfHandler
}
Expand Down Expand Up @@ -794,6 +797,15 @@ func MuxRouterProvider() *mux.Router {
return mux.NewRouter().UseEncodedPath()
}

func httpEnabled(cfg *config.Config, serviceName primitives.ServiceName) bool {
// If the service is not the frontend service, HTTP API is disabled
if serviceName != primitives.FrontendService {
return false
}
// If HTTP API port is 0, it is disabled
return cfg.Services[string(serviceName)].RPC.HTTPPort != 0
}

// HTTPAPIServerProvider provides an HTTP API server if enabled or nil
// otherwise.
func HTTPAPIServerProvider(
Expand All @@ -810,15 +822,10 @@ func HTTPAPIServerProvider(
logger log.Logger,
router *mux.Router,
) (*HTTPAPIServer, error) {
// If the service is not the frontend service, HTTP API is disabled
if serviceName != primitives.FrontendService {
if !httpEnabled(cfg, serviceName) {
return nil, nil
}
// If HTTP API port is 0, it is disabled
rpcConfig := cfg.Services[string(serviceName)].RPC
if rpcConfig.HTTPPort == 0 {
return nil, nil
}
return NewHTTPAPIServer(
serviceConfig,
rpcConfig,
Expand Down
5 changes: 4 additions & 1 deletion service/frontend/workflow_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ type (
healthInterceptor *interceptor.HealthInterceptor
scheduleSpecBuilder *scheduler.SpecBuilder
outstandingPollers collection.SyncMap[string, collection.SyncMap[string, context.CancelFunc]]
httpEnabled bool
}
)

Expand Down Expand Up @@ -173,6 +174,7 @@ func NewWorkflowHandler(
membershipMonitor membership.Monitor,
healthInterceptor *interceptor.HealthInterceptor,
scheduleSpecBuilder *scheduler.SpecBuilder,
httpEnabled bool,
) *WorkflowHandler {

handler := &WorkflowHandler{
Expand Down Expand Up @@ -225,6 +227,7 @@ func NewWorkflowHandler(
healthInterceptor: healthInterceptor,
scheduleSpecBuilder: scheduleSpecBuilder,
outstandingPollers: collection.NewSyncMap[string, collection.SyncMap[string, context.CancelFunc]](),
httpEnabled: httpEnabled,
}

return handler
Expand Down Expand Up @@ -2922,7 +2925,7 @@ func (wh *WorkflowHandler) GetSystemInfo(ctx context.Context, request *workflows
SdkMetadata: true,
BuildIdBasedVersioning: true,
CountGroupByExecutionStatus: true,
Nexus: wh.config.EnableNexusAPIs(),
Nexus: wh.httpEnabled && wh.config.EnableNexusAPIs(),
},
}, nil
}
Expand Down
4 changes: 2 additions & 2 deletions service/frontend/workflow_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ func (s *WorkflowHandlerSuite) getWorkflowHandler(config *Config) *WorkflowHandl
s.mockResource.GetMembershipMonitor(),
healthInterceptor,
scheduler.NewSpecBuilder(),
true,
)
}

Expand Down Expand Up @@ -2069,8 +2070,7 @@ func (s *WorkflowHandlerSuite) TestGetSystemInfo() {
s.True(resp.Capabilities.SupportsSchedules)
s.True(resp.Capabilities.EncodedFailureAttributes)
s.True(resp.Capabilities.UpsertMemo)
// Nexus is enabled by a dynamic config feature flag which defaults to false.
s.False(resp.Capabilities.Nexus)
s.True(resp.Capabilities.Nexus)
}

func (s *WorkflowHandlerSuite) TestStartBatchOperation_Terminate() {
Expand Down
1 change: 0 additions & 1 deletion service/history/tests/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ func NewDynamicConfig() *configs.Config {
config.EnableActivityEagerExecution = dynamicconfig.GetBoolPropertyFnFilteredByNamespace(true)
config.EnableEagerWorkflowStart = dynamicconfig.GetBoolPropertyFnFilteredByNamespace(true)
config.NamespaceCacheRefreshInterval = dynamicconfig.GetDurationPropertyFn(time.Second)
config.EnableNexus = dynamicconfig.GetBoolPropertyFn(true)
config.ReplicationEnableUpdateWithNewTaskMerge = dynamicconfig.GetBoolPropertyFn(true)
config.EnableWorkflowExecutionTimeoutTimer = dynamicconfig.GetBoolPropertyFn(true)
config.EnableWorkflowIdReuseStartTimeValidation = dynamicconfig.GetBoolPropertyFnFilteredByNamespace(true)
Expand Down
2 changes: 0 additions & 2 deletions tests/callbacks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ func (s *CallbacksSuite) TestWorkflowCallbacks_InvalidArgument() {
}

func (s *CallbacksSuite) TestWorkflowNexusCallbacks_CarriedOver() {
s.OverrideDynamicConfig(dynamicconfig.EnableNexus, true)
s.OverrideDynamicConfig(
callbacks.AllowedAddresses,
[]any{map[string]any{"Pattern": "*", "AllowInsecure": true}},
Expand Down Expand Up @@ -337,7 +336,6 @@ func (s *CallbacksSuite) TestWorkflowNexusCallbacks_CarriedOver() {
}

func (s *CallbacksSuite) TestNexusResetWorkflowWithCallback() {
s.OverrideDynamicConfig(dynamicconfig.EnableNexus, true)
s.OverrideDynamicConfig(
callbacks.AllowedAddresses,
[]any{map[string]any{"Pattern": "*", "AllowInsecure": true}},
Expand Down
1 change: 0 additions & 1 deletion tests/testcore/client_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ func (s *ClientFunctionalSuite) SetupSuite() {
dynamicconfig.FrontendEnableWorkerVersioningDataAPIs.Key(): true,
dynamicconfig.FrontendEnableWorkerVersioningWorkflowAPIs.Key(): true,
dynamicconfig.FrontendMaxConcurrentBatchOperationPerNamespace.Key(): ClientSuiteLimit,
dynamicconfig.EnableNexus.Key(): true,
dynamicconfig.RefreshNexusEndpointsMinWait.Key(): 1 * time.Millisecond,
callbacks.AllowedAddresses.Key(): []any{map[string]any{"Pattern": "*", "AllowInsecure": true}},
}
Expand Down
1 change: 0 additions & 1 deletion tests/testcore/functional.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ func (s *FunctionalSuite) SetupSuite() {
s.dynamicConfigOverrides = map[dynamicconfig.Key]any{
dynamicconfig.RetentionTimerJitterDuration.Key(): time.Second,
dynamicconfig.EnableEagerWorkflowStart.Key(): true,
dynamicconfig.EnableNexus.Key(): true,
dynamicconfig.FrontendEnableExecuteMultiOperation.Key(): true,
}
s.FunctionalTestBase.SetupSuite("testdata/es_cluster.yaml")
Expand Down
1 change: 0 additions & 1 deletion tests/testcore/functional_test_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ func (s *FunctionalTestBase) SetupSuite(defaultClusterConfigFile string, options
dynamicconfig.TaskQueueScannerEnabled.Key(): false,
dynamicconfig.ExecutionsScannerEnabled.Key(): false,
dynamicconfig.BuildIdScavengerEnabled.Key(): false,
dynamicconfig.EnableNexus.Key(): true,
// Better to read through in tests than add artificial sleeps (which is what we previously had).
dynamicconfig.ForceSearchAttributesCacheRefreshOnRead.Key(): true,
})
Expand Down
5 changes: 2 additions & 3 deletions tests/xdc/nexus_request_forwarding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@ func (s *NexusRequestForwardingSuite) SetupSuite() {
s.dynamicConfigOverrides = map[dynamicconfig.Key]any{
// Make sure we don't hit the rate limiter in tests
dynamicconfig.FrontendGlobalNamespaceNamespaceReplicationInducingAPIsRPS.Key(): 1000,
dynamicconfig.EnableNexus.Key(): true,
dynamicconfig.RefreshNexusEndpointsMinWait.Key(): 1 * time.Millisecond,
callbacks.AllowedAddresses.Key(): []any{map[string]any{"Pattern": "*", "AllowInsecure": true}},
dynamicconfig.RefreshNexusEndpointsMinWait.Key(): 1 * time.Millisecond,
callbacks.AllowedAddresses.Key(): []any{map[string]any{"Pattern": "*", "AllowInsecure": true}},
}
s.setupSuite([]string{"nexus_request_forwarding_active", "nexus_request_forwarding_standby"})
}
Expand Down
5 changes: 2 additions & 3 deletions tests/xdc/nexus_state_replication_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@ func (s *NexusStateReplicationSuite) SetupSuite() {
s.dynamicConfigOverrides = map[dynamicconfig.Key]any{
// Make sure we don't hit the rate limiter in tests
dynamicconfig.FrontendGlobalNamespaceNamespaceReplicationInducingAPIsRPS.Key(): 1000,
dynamicconfig.EnableNexus.Key(): true,
dynamicconfig.RefreshNexusEndpointsMinWait.Key(): 1 * time.Millisecond,
callbacks.AllowedAddresses.Key(): []any{map[string]any{"Pattern": "*", "AllowInsecure": true}},
dynamicconfig.RefreshNexusEndpointsMinWait.Key(): 1 * time.Millisecond,
callbacks.AllowedAddresses.Key(): []any{map[string]any{"Pattern": "*", "AllowInsecure": true}},
}
s.setupSuite([]string{"nexus_state_replication_active", "nexus_state_replication_standby"})
}
Expand Down

0 comments on commit d07d0a5

Please sign in to comment.