cli,server: initial cluster configuration via job injection#98380
Closed
knz wants to merge 1 commit intocockroachdb:masterfrom
Closed
cli,server: initial cluster configuration via job injection#98380knz wants to merge 1 commit intocockroachdb:masterfrom
knz wants to merge 1 commit intocockroachdb:masterfrom
Conversation
This change introduces two new mechanisms: - a new way to inject SQL statements upon initialization of the SQL layer, with exactly-once semantics. The TLDR is that the SQL server initialization code obtains an "injected SQL" payload from its configuration and synthetizes a one-off job to execute that payload. Because the payload is executed as a job, it will execute exactly once and will be guaranteed to execute even if the server that created the job terminates before the job starts or completes. (Another server will pick it up.) This mechanism is intended for use both by secondary tenants and the system tenant. - a "config profiles" mechanism for the system tenant's SQL service, whereby either a command-line flag (`--init-profile`) or an env var (`COCKROACH_INIT_PROFILE`) can be used to choose a pre-defined "injected SQL" payload to populate in the server configuration. This leverages the mechanism defined above. Implementation detail: all job entries created by this mechanism have the job column`created_by_name` set to `injected`. The unicity of the job entry is enforced using unique values for the column `created_by_id`. Release note: None
Member
This was referenced Mar 11, 2023
Contributor
Author
|
superseded by #98466. |
craig bot
pushed a commit
that referenced
this pull request
Apr 20, 2023
98466: cli,server: static configuration profiles r=stevendanna a=knz 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 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`. Release note: None 101907: multitenant: misc fixes related to tenant capabilities r=arulajmani a=knz See individual commits for details. The last commit in particular probably addresses #99087. Epic: CRDB-23559 101935: sql: add issue number to todo r=rharding6373 a=rharding6373 Epic: none Informs: #101934 Release note: none Co-authored-by: Raphael 'kena' Poss <knz@thaumogen.net> Co-authored-by: rharding6373 <rharding6373@users.noreply.github.com>
This was referenced Apr 20, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Informs #94856.
This change introduces two new mechanisms:
a new way to inject SQL statements upon initialization of the SQL layer, with exactly-once semantics. The TLDR is that the SQL server initialization code obtains an "injected SQL" payload from its configuration and synthetizes a one-off job to execute that payload.
Because the payload is executed as a job, it will execute exactly once and will be guaranteed to execute even if the server that created the job terminates before the job starts or completes. (Another server will pick it up.)
This mechanism is intended for use both by secondary tenants and the system tenant.
a "config profiles" mechanism for the system tenant's SQL service, whereby either a command-line flag (
--init-profile) or an env var (COCKROACH_INIT_PROFILE) can be used to choose a pre-defined "injected SQL" payload to populate in the server configuration.This leverages the mechanism defined above.
Implementation detail: all job entries created by this mechanism have the job column
created_by_nameset toinjected. The unicity of the job entry is enforced using unique values for the columncreated_by_id.Release note: None