diff --git a/pkg/base/test_server_args.go b/pkg/base/test_server_args.go index 2f528b278d66..10c86dfd1d0a 100644 --- a/pkg/base/test_server_args.go +++ b/pkg/base/test_server_args.go @@ -340,7 +340,7 @@ type TestTenantArgs struct { // Cockroach Labs. Should remain disabled during unit testing. StartDiagnosticsReporting bool - // InProcessTenant is used to initialize tenants through the - // kv server's `serverController` in the same process. - InProcessTenant bool + // UseServerController tells testserver.StartTenant() to use + // its serverController to start the secondary tenant. + UseServerController bool } diff --git a/pkg/cli/cliflags/flags.go b/pkg/cli/cliflags/flags.go index 8cf2c75bc75d..a84bac95810f 100644 --- a/pkg/cli/cliflags/flags.go +++ b/pkg/cli/cliflags/flags.go @@ -1343,16 +1343,14 @@ More information about the geo-partitioned replicas topology can be found at: Description: ` If set, cockroach demo will start separate in-memory KV and SQL servers in multi-tenancy mode. The SQL shell will be connected to the first tenant, and can be switched between tenants -and the system tenant using the \connect command. By default the tenant will be initialized -in-process. Use --simulate-separate-tenant-process to emulate a separate tenant process. -`, +and the system tenant using the \connect command.`, } - DemoInProcessTenant = FlagInfo{ - Name: "in-process-tenant", + DemoDisableServerController = FlagInfo{ + Name: "disable-server-controller", Description: ` -If set, and --multitenant is set to true, the tenant process will be started -in-process.`, +If set, the server controller will not be used to start secondary +tenant servers.`, } DemoNoLicense = FlagInfo{ diff --git a/pkg/cli/context.go b/pkg/cli/context.go index d2747f30d2ef..b97de80a087d 100644 --- a/pkg/cli/context.go +++ b/pkg/cli/context.go @@ -618,7 +618,7 @@ func setDemoContextDefaults() { demoCtx.HTTPPort, _ = strconv.Atoi(base.DefaultHTTPPort) demoCtx.WorkloadMaxQPS = 25 demoCtx.Multitenant = true - demoCtx.InProcessTenant = true + demoCtx.DisableServerController = false demoCtx.DefaultEnableRangefeeds = true demoCtx.pidFile = "" diff --git a/pkg/cli/democluster/context.go b/pkg/cli/democluster/context.go index 1371edc728a1..9fe8a420709f 100644 --- a/pkg/cli/democluster/context.go +++ b/pkg/cli/democluster/context.go @@ -107,8 +107,9 @@ type Context struct { // out enabled. DefaultEnableRangefeeds bool - // InProcessTenant is true if we want to emulate an in-process tenant. - InProcessTenant bool + // DisableServerController is true if we want to avoid the server + // controller to instantiate tenant secondary servers. + DisableServerController bool } // IsInteractive returns true if the demo cluster configuration diff --git a/pkg/cli/democluster/demo_cluster.go b/pkg/cli/democluster/demo_cluster.go index 35c3c1ae1307..72cda2058562 100644 --- a/pkg/cli/democluster/demo_cluster.go +++ b/pkg/cli/democluster/demo_cluster.go @@ -218,7 +218,7 @@ func NewDemoCluster( // tenant. // Note: this logic can be removed once we use a single // listener for HTTP and SQL. - if !c.demoCtx.InProcessTenant { + if c.demoCtx.DisableServerController { c.httpFirstPort += c.demoCtx.NumNodes } c.sqlFirstPort += c.demoCtx.NumNodes @@ -430,7 +430,7 @@ func (c *transientCluster) Start(ctx context.Context) (err error) { DisableCreateTenant: !createTenant, TenantName: roachpb.TenantName("demo-tenant"), TenantID: roachpb.MustMakeTenantID(secondaryTenantID), - InProcessTenant: c.demoCtx.InProcessTenant, + UseServerController: !c.demoCtx.DisableServerController, TestingKnobs: base.TestingKnobs{ Server: &server.TestingKnobs{ ContextTestingKnobs: rpc.ContextTestingKnobs{ @@ -442,7 +442,7 @@ func (c *transientCluster) Start(ctx context.Context) (err error) { } var tenantStopper *stop.Stopper - if !c.demoCtx.InProcessTenant { + if c.demoCtx.DisableServerController { tenantStopper = stop.NewStopper() args.Stopper = tenantStopper args.ForceInsecure = c.demoCtx.Insecure @@ -455,9 +455,9 @@ func (c *transientCluster) Start(ctx context.Context) (err error) { } ts, err := c.servers[i].StartTenant(ctx, args) - if !c.demoCtx.InProcessTenant { - // InProcessTenant means that the server controller is - // already taking care of shutdown. + if c.demoCtx.DisableServerController { + // If we use the server controller, it is already taking + // care of shutdown. c.stopper.AddCloser(stop.CloserFn(func() { stopCtx := context.Background() if ts != nil { @@ -858,7 +858,7 @@ func (demoCtx *Context) testServerArgsForTransientCluster( args.SQLAddr = fmt.Sprintf("127.0.0.1:%d", sqlPort) args.HTTPAddr = fmt.Sprintf("127.0.0.1:%d", httpPort) - if demoCtx.InProcessTenant { + if !demoCtx.DisableServerController { // The code in NewDemoCluster put the KV ports higher // so we need to subtract the number of nodes to get // back to the "good" ports. @@ -1820,7 +1820,7 @@ func (c *transientCluster) ListDemoNodes(w, ew io.Writer, justOne, verbose bool) // Connection parameters for the system tenant follow. uiURL := s.Cfg.AdminURL() - if q := uiURL.Query(); c.demoCtx.Multitenant && c.demoCtx.InProcessTenant && !q.Has(server.TenantNameParamInQueryURL) { + if q := uiURL.Query(); c.demoCtx.Multitenant && !c.demoCtx.DisableServerController && !q.Has(server.TenantNameParamInQueryURL) { q.Add(server.TenantNameParamInQueryURL, catconstants.SystemTenantName) uiURL.RawQuery = q.Encode() } diff --git a/pkg/cli/flags.go b/pkg/cli/flags.go index 3b6db50d6572..88c38f34fa59 100644 --- a/pkg/cli/flags.go +++ b/pkg/cli/flags.go @@ -795,11 +795,11 @@ func init() { cliflagcfg.BoolFlag(f, &demoCtx.DefaultEnableRangefeeds, cliflags.DemoEnableRangefeeds) cliflagcfg.BoolFlag(f, &demoCtx.Multitenant, cliflags.DemoMultitenant) - cliflagcfg.BoolFlag(f, &demoCtx.InProcessTenant, cliflags.DemoInProcessTenant) + cliflagcfg.BoolFlag(f, &demoCtx.DisableServerController, cliflags.DemoDisableServerController) // TODO(knz): Currently the multitenant UX for 'demo' is not // satisfying for end-users. Let's not advertise it too much. _ = f.MarkHidden(cliflags.DemoMultitenant.Name) - _ = f.MarkHidden(cliflags.DemoInProcessTenant.Name) + _ = f.MarkHidden(cliflags.DemoDisableServerController.Name) cliflagcfg.BoolFlag(f, &demoCtx.SimulateLatency, cliflags.Global) // We also support overriding the GEOS library path for 'demo'. diff --git a/pkg/server/testserver.go b/pkg/server/testserver.go index d98db7c66cab..52c525ffb1c8 100644 --- a/pkg/server/testserver.go +++ b/pkg/server/testserver.go @@ -831,7 +831,7 @@ func (ts *TestServer) StartTenant( } } - if params.InProcessTenant { + if params.UseServerController { onDemandServer, err := ts.serverController.getOrCreateServer(ctx, params.TenantName) if err != nil { return nil, err