-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cli,server: static configuration profiles #98466
Conversation
fc2444e
to
edf31c4
Compare
f119880
to
ce2a284
Compare
edf31c4
to
2dd1f66
Compare
ce2a284
to
59bfefe
Compare
2dd1f66
to
dd0e914
Compare
59bfefe
to
867deef
Compare
dd0e914
to
db90e42
Compare
867deef
to
310cb7a
Compare
35d6141
to
62781e4
Compare
20883fd
to
c79194c
Compare
958eb8a
to
3dfa064
Compare
pkg/configprofiles/profiles.go
Outdated
// "ALTER TENANT template SET CLUSTER SETTING spanconfig.tenant_split.enabled = false", | ||
// Disable RU accounting. | ||
// TODO(knz): Move this to in-tenant config task. | ||
"SELECT crdb_internal.update_tenant_resource_limits('template', 10000000000, 0, 10000000000, now(), 0)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this anymore since we won't have the RU limiter for shared-process tenants by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplified.
RFAL - I have also added tests to confirm the config is applied when a profile is selected. |
13fd15a
to
6e33f98
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, this looks reasonable to me although I'm not 100% up to speed on the provider interface. I left one possible addition to the configuration profiles.
pkg/configprofiles/profiles.go
Outdated
"ALTER TENANT template GRANT CAPABILITY can_admin_relocate_range, can_admin_unsplit, can_view_node_info, can_view_tsdb_metrics, exempt_from_rate_limiting", | ||
// Disable span config limits and splitter. | ||
// TODO(knz): Move this to in-tenant config task. | ||
"ALTER TENANT template SET CLUSTER SETTING spanconfig.tenant_limit = 1000000", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this anymore since we don't install the spanconfig limiter for shared-process tenants by default.
} | ||
|
||
var multitenantClusterInitTasks = []autoconfigpb.Task{ | ||
makeTask("initial cluster config", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also enable rangefeed's here so that it can be used as a replication source more easily.
// Cluster initialization. We only do this for a regular start command; | ||
// SQL-only servers get their initialization payload from their tenant | ||
// configuration. | ||
cliflagcfg.VarFlag(f, configprofiles.NewProfileSetter(&serverCfg.AutoConfigProvider), cliflags.ConfigProfile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm reading the code correctly, the server config is given a NoTaskProvider by default and then the NewProfileSetter will install a new provider if the configuration value is set. 👍
var _ acprovider.Provider = (*profileTaskProvider)(nil) | ||
|
||
// EnvUpdate is part of the acprovider.Provider interface. | ||
func (p *profileTaskProvider) EnvUpdate() <-chan struct{} { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth noting the obvious: We return a channel that won't see updates because static profiles can't be updated.
This change introduces a mechanism through which an operator can select a "configuration profile" via the command-line flag `--config-profile` or env var `COCKROACH_CONFIG_PROFILE`. The SQL initialization defined by the profile is applied during server start-up. The profiles are (currently) hardcoded inside CockroachDB. The following profiles are predefined: - `default`: no configuration. - `multitenant+noapp`: no pre-defined `application` tenant, but with a predefined application tenant template that is used whenever a new tenant is defined. This config profile is meant for use for C2C replication target clusters. - `multitenant+app+sharedservice`: shared-process multitenancy with pre-defined `application` tenant, based off the same configuration as `multitenant+noapp`. - `replication-source`: alias for `multitenant+app+sharedservice` - `replication-target`: alias for `multitenant+noapp` Release note: None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @ajwerner and @stevendanna)
pkg/cli/flags.go
line 400 at r6 (raw file):
Previously, stevendanna (Steven Danna) wrote…
If I'm reading the code correctly, the server config is given a NoTaskProvider by default and then the NewProfileSetter will install a new provider if the configuration value is set. 👍
Correct.
pkg/configprofiles/profiles.go
line 77 at r3 (raw file):
Previously, stevendanna (Steven Danna) wrote…
It's unclear if we'll need this now that this rate limiter is attached to the capability system.
I removed this already.
pkg/configprofiles/profiles.go
line 124 at r5 (raw file):
Previously, stevendanna (Steven Danna) wrote…
I don't think we need this anymore since we don't install the spanconfig limiter for shared-process tenants by default.
I think we'll do good to keep it for when/if we ever lift the deployment to separate-process.
pkg/configprofiles/profiles.go
line 92 at r6 (raw file):
Previously, stevendanna (Steven Danna) wrote…
We could also enable rangefeed's here so that it can be used as a replication source more easily.
Rangefeeds are enabled by default already.
pkg/configprofiles/provider.go
line 35 at r6 (raw file):
Previously, stevendanna (Steven Danna) wrote…
Might be worth noting the obvious: We return a channel that won't see updates because static profiles can't be updated.
Done.
6e33f98
to
f3547ec
Compare
bors r=stevendanna |
Build succeeded: |
Encountered an error creating backports. Some common things that can go wrong:
You might need to create your backport manually using the backport tool. error setting reviewers, but backport branch blathers/backport-release-23.1-98466 is ready: POST https://api.github.com/repos/cockroachdb/cockroach/pulls/101957/requested_reviewers: 422 Reviews may only be requested from collaborators. One or more of the teams you specified is not a collaborator of the cockroachdb/cockroach repository. [] Backport to branch 23.1.x failed. See errors above. error setting reviewers, but backport branch blathers/backport-release-23.1.0-98466 is ready: POST https://api.github.com/repos/cockroachdb/cockroach/pulls/101958/requested_reviewers: 422 Reviews may only be requested from collaborators. One or more of the teams you specified is not a collaborator of the cockroachdb/cockroach repository. [] Backport to branch 23.1.0 failed. See errors above. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
Epic: CRDB-23559
Informs #98431.
Fixes #94856.
(Based off #98459)
Supersedes #98380.
This change introduces a mechanism through which an operator can
select a "configuration profile" via the command-line flag
--config-profile
or env varCOCKROACH_CONFIG_PROFILE
. The SQLinitialization defined by the profile is applied during server
start-up.
The profiles are (currently) hardcoded inside CockroachDB.
The following profiles are predefined:
default
: no configuration.multitenant+noapp
: no pre-definedapplication
tenant, but with apredefined application tenant template that is used whenever a new
tenant is defined. This config profile is meant for use for C2C
replication target clusters.
multitenant+app+sharedservice
: shared-process multitenancy withpre-defined
application
tenant, based off the same configuration asmultitenant+noapp
.Release note: None