forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
120051: roachtest: refactor virtual cluster API r=DarrylWong a=renatolabs **roachtest: rename `TenantName` to `VirtualClusterName`** This is a roachtest API; the renaming makes it more consistent with the naming used by the roachprod API. **roachprod: remove `KV*` fields from `StartOpts`** Instead, use `StorageCluster` instead of `KVCluster` (for consistency across the codebase). `KVAddrs` is also deprecated as a field, as it can be generated on demand. **roachtest: make startOpts customizations composable** Previously, the `option` package would define a number of "default" start options that could be used when starting cockroach: `NoBackups`, to disable the roachprod backup schedule; `InMemory`, to start an in-memory database; `SingleNode`, to skip initialization, etc. This created a pattern where every different use would lead to the creation of another method that used the default options except for _some_ setting. This is less than ideal since it doesn't compose: if we wanted to create start options to skip init *and* the backup schedule, one would either need to create a new, bespoke function, or reach directly to roachprod-level options in the test. In this commit, we use the well established functional options pattern, allowing the start options to easily compose. Instead of writing: ```go startOpts := option.DefaultStartOptsNoBackups() ``` we now write: ```go startOpts := option.NewStartOpts(option.NoBackupSchedule) ``` The `NewStartOpts` function takes a list of options that customize the start options generated. **roachtest: simplify `StartServiceForVirtualCluster`** This commit refactors the API exposed to tests when they want to create virtual clusters. Specifically, we no longer require a "storage cluster" when creating a shared process virtual cluster, and we also make use of the functional options pattern introduced earlier in order to allow the caller to customize where and how the virtual cluster is to be deployed. Callers can now create a new shared-process virtual cluster by using `option.StartSharedVirtualClusterOpts`, which just takes a virtual cluster name. For separate process tenants, there is `option.StartVirtualClusterOpts` which takes the virtual cluster name and the nodes where the SQL server should be deployed. We also change the API so that callers are only required to pass a "SQL instance" if the test is deploying more than one instance of the same virtual cluster on the same node. The concept of "SQL instance" is confusing and foreign to most engineers, and it only really matters in the case of several instances of the same VC in the same node. Co-authored-by: Renato Costa <renato@cockroachlabs.com>
- Loading branch information
Showing
73 changed files
with
366 additions
and
243 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.