-
Notifications
You must be signed in to change notification settings - Fork 3.9k
/
Copy pathtenant_config.go
54 lines (47 loc) · 2.12 KB
/
tenant_config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright 2023 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.
package multitenant
import (
"time"
"github.com/cockroachdb/cockroach/pkg/settings"
"github.com/cockroachdb/cockroach/pkg/sql/sem/catconstants"
)
// DefaultClusterSelectSettingName is the name of the setting that
// configures the default tenant to use when a client does not specify
// a specific tenant.
const DefaultClusterSelectSettingName = "server.controller.default_target_cluster"
// DefaultTenantSelect determines which tenant serves requests from
// clients that do not specify explicitly the tenant they want to use.
var DefaultTenantSelect = settings.RegisterStringSetting(
settings.SystemOnly,
"server.controller.default_tenant",
"name of the virtual cluster to use when SQL or HTTP clients don't specify a target cluster",
catconstants.SystemTenantName,
settings.WithName(DefaultClusterSelectSettingName),
)
// VerifyTenantService determines whether there should be an advisory
// interlock between changes to the tenant service and changes to the
// above cluster setting.
var VerifyTenantService = settings.RegisterBoolSetting(
settings.SystemOnly,
"server.controller.default_tenant.check_service.enabled",
"verify that the service mode is coherently set with the value of "+DefaultClusterSelectSettingName,
true,
settings.WithName(DefaultClusterSelectSettingName+".check_service.enabled"),
)
// WaitForClusterStartTimeout is the amount of time the tenant
// controller will wait for the default virtual cluster to have an
// active SQL server, if WaitForClusterStart is true.
var WaitForClusterStartTimeout = settings.RegisterDurationSetting(
settings.SystemOnly,
"server.controller.mux_virtual_cluster_wait.timeout",
"amount of time to wait for a default virtual cluster to become available when serving SQL connections (0 to disable)",
10*time.Second,
)