migrations part 1/2: add version cluster setting#17216
migrations part 1/2: add version cluster setting#17216tbg merged 1 commit intocockroachdb:masterfrom
Conversation
a2fe5b1 to
5979ae8
Compare
|
Looking good. Some nits below and confusion about the Review status: 0 of 32 files reviewed at latest revision, 6 unresolved discussions, some commit checks failed. pkg/base/cluster_version.go, line 43 at r1 (raw file):
This is mildly confusing. 1.0.1 doesn't correspond to the actual 1.0.1 release, right? pkg/base/cluster_version.proto, line 32 at r1 (raw file):
Bikeshed: should this be named pkg/migration/version.go, line 31 at r1 (raw file):
Should this method be pkg/migration/version.go, line 52 at r1 (raw file):
The pkg/settings/statemachine.go, line 62 at r1 (raw file):
I haven't fully grok'ed the usage here, so apologies if this is misguided: did you consider adding a pkg/sql/show.go, line 96 at r1 (raw file):
I thought Comments from Reviewable |
|
I like Review status: 0 of 32 files reviewed at latest revision, 6 unresolved discussions, some commit checks failed. pkg/base/cluster_version.go, line 43 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
I think most of your confusion comes from the fact that version=major.minor.patch.unstable, but we always have patch==0 (RFC wants this) but don't want to print the patch version. I would be happy to turn the patch proto field into a reserved one and rip it out of the logic for now. pkg/settings/statemachine.go, line 62 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
a validation doesn't cut it because the new value is the result of the validation. You also need the input to always be consistent or your output won't be (potentially breaking monotonicity of min_version). Plus you have a diverging internal (what's in the table) and external representation (what's showed to the client) which needs to be translated both ways. I initially tried exactly what you're describing but, yeah, it's more complicated to the point where it's easier to just make a new setting. pkg/sql/show.go, line 96 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
You can see from the adjacent code that it isn't. It just reads the setting variable, but that isn't consistent. I think I would want to make I think though that if you show all cluster settings, you get a consistent read, maybe? return p.delegateQuery(ctx, "SHOW CLUSTER SETTINGS",
"TABLE crdb_internal.cluster_settings", nil, nil)I also feel that I shouldn't be hooking into Comments from Reviewable |
|
Review status: 0 of 32 files reviewed at latest revision, 6 unresolved discussions, some commit checks failed. pkg/settings/statemachine.go, line 62 at r1 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Ack. I wonder if there is a better term for this than "state machine". Yeah, it is a state machine, but so are so many other things. I guess the term feels to general purpose. pkg/sql/show.go, line 96 at r1 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Yeah, I'd want Comments from Reviewable |
|
Review status: 0 of 32 files reviewed at latest revision, 6 unresolved discussions, some commit checks failed. pkg/settings/statemachine.go, line 62 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
I find it pretty spot on and I don't like bikeshedding enough to participate, but if you come up with a stellar suggestion I'll be happy to rename. pkg/sql/show.go, line 96 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
There's a straightforward reason, which is that nothing is written to the table unless the default is changed. This is actually a problem I need to address, as every cluster should always have the version setting as a running node can't really guess a default. It could be made workable because all nodes that know about versioning could persist their running versions and use that as the default, but this only seems to invite further complication. This means that cluster init has to populate at least that setting, at which point it might as well populate all of them. Comments from Reviewable |
|
LGTM Reviewed 35 of 35 files at r1. pkg/settings/statemachine.go, line 62 at r1 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
I also don't like StatemachineSetting, but my best alternative, TransitionSetting, isn't very good either. I would, however, spell StatemachineSetting with a capital M. Comments from Reviewable |
|
Review status: all files reviewed at latest revision, 7 unresolved discussions, some commit checks failed. pkg/settings/statemachine.go, line 31 at r1 (raw file):
nit: s/equal/even/ right? pkg/settings/updater.go, line 58 at r1 (raw file):
huh, is this a style rule I missed? Comments from Reviewable |
|
Review status: all files reviewed at latest revision, 8 unresolved discussions, some commit checks failed. pkg/sql/show.go, line 96 at r1 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
yeah, the settings design in the initial rfc basically sees the table as only for overrides of defaults:
Comments from Reviewable |
Implement (hopefully) more than 50% of the migration RFC[1]. Specifically, - add a StateMachineSetting to the `settings` package - use it for `SET CLUSTER SETTING version = '<major>.<minor>-<unstable>'` - pass a newly created `*ExposedClusterVersion` around - use `(*ExposedClusterVersion).IsActive(targetVersion)` to toggle existing features that so far used the stub `util.IsMigrated()` - remove `util.IsMigrated()`. The missing part is incorporating the remaining parts of [2], that is, storing the seen version to disk. [1]: cockroachdb#16977 [2]: cockroachdb#17155
|
TFTRs! Merging on green. Review status: 13 of 33 files reviewed at latest revision, 9 unresolved discussions, some commit checks pending. pkg/base/cluster_version.proto, line 32 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
I'll leave as is for now, keeping the wording congruent with the RFC. pkg/migration/version.go, line 31 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
Good point, done. pkg/migration/version.go, line 52 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
I changed the version to pkg/settings/statemachine.go, line 31 at r1 (raw file): Previously, dt (David Taylor) wrote…
Yep, thanks. Fixed. pkg/settings/statemachine.go, line 62 at r1 (raw file): Previously, bdarnell (Ben Darnell) wrote…
pkg/settings/updater.go, line 58 at r1 (raw file): Previously, dt (David Taylor) wrote…
Nope, just a spurious diff. Reverted. pkg/sql/show.go, line 96 at r1 (raw file): Previously, dt (David Taylor) wrote…
That distinction between Comments from Reviewable |
|
Review status: 13 of 33 files reviewed at latest revision, 6 unresolved discussions, all commit checks successful. pkg/sql/show.go, line 96 at r1 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
For the diagnostic reporting setting, semantically we wanted a default of true, but since settings need to be allowed to return defaults until they are read and didn't want to risk ignoring an explicit false and betraying user trust, we went with a default of false with a startup migration writing an explicit true (optInToDiagnosticsStatReporting in migrations.go). This feels pretty similar. Comments from Reviewable |
The packages were rearranged in cockroachdb#17216
|
Does |
|
I responded to this offline, but for posterity: I feel fairly strongly that the less singletons, the better. The cluster version setting var is a particularly annoying, because due to it it's impossible to run mixed version cluster tests unless we're going straight for acceptance tests (in which case we have to juggle binary versions, etc, and Docker pain). Plumbing can certainly be annoying, but I think it's the lesser of two evils almost always, and there are some ways to make it more pleasant which I'm happy to contribute to moving forward. |
We introduced the custom StateMachineSetting type in cockroachdb#17216 to power the underlying machinery for version upgrades: SET CLUSTER SETTING version = <major>-<minor>; At the time we left it generalizable enough to make room for future settings with arbitrary internal transitions. For cluster versions this meant only allowing transitions from one major version to the immediate next, all the while making sure that each binary in the cluster was able to activate the targeted version (the proposed version fell within the allowable range ["binary min supported version", "binary version"]). In the three years since we haven't added any state-machine validated settings that fit the bill, and the layers of abstractions to get to validated cluster version updates are one too many for (my) comfort. This PR introduces a new VersionSetting type that is more tightly coupled with the ClusterVersion type itself. VersionSetting uses language that only appropriate for cluster versions, hopefully clarifying things as we go. We'll depend on this clarification in future PRs when we remove the use of gossip in disseminating cluster version bumps. Release note (sql/cli change): The underlying type for the version cluster setting has been changed. Previously it was of an internal type representing "state machine", but now it's simply "version". This has no operational implications, but it does reflect differently in a few spots: - The `Type` column in `cockroach gen settings-list` will now show "version" instead of "custom validation" - The `setting_type` column for `version` in `SHOW CLUSTER SETTINGS` will now show a "v" instead of an "m" - The `valueType` column for `version` in `system.settings` will now show a "v" instead of an "m"
We introduced the custom StateMachineSetting type in cockroachdb#17216 to power the underlying machinery for version upgrades: SET CLUSTER SETTING version = <major>-<minor>; At the time we left it generalizable enough to make room for future settings with arbitrary internal transitions. For cluster versions this meant only allowing transitions from one major version to the immediate next, all the while making sure that each binary in the cluster was able to activate the targeted version (the proposed version fell within the allowable range ["binary min supported version", "binary version"]). In the three years since we haven't added any state-machine validated settings that fit the bill, and the layers of abstractions to get to validated cluster version updates are one too many for (my) comfort. This PR introduces a new VersionSetting type that is more tightly coupled with the ClusterVersion type itself. VersionSetting uses language that only appropriate for cluster versions, hopefully clarifying things as we go. We'll depend on this clarification in future PRs when we remove the use of gossip in disseminating cluster version bumps. Release note (sql/cli change): The underlying type for the version cluster setting has been changed. Previously it was of an internal type representing "state machine", but now it's simply "version". This has no operational implications, but it does reflect differently in a few spots: - The `Type` column in `cockroach gen settings-list` will now show "version" instead of "custom validation" - The `setting_type` column for `version` in `SHOW CLUSTER SETTINGS` will now show a "v" instead of an "m" - The `valueType` column for `version` in `system.settings` will now show a "v" instead of an "m"
55877: rowflow: account for more memory usage of the row buffer r=yuzefovich a=yuzefovich Previously, we accounted for the memory usage of the row buffer from which the rows are pushed from in the routers only when copying the rows from the row container, but we also have another in-memory row buffer that we can move the rows from which was missing the memory accounting. This is now fixed which also deflakes the router disk spill test. Fixes: #55848. Release note: None 55907: sql: remove vectorize=201auto option r=yuzefovich a=yuzefovich `201auto` option of `vectorize` setting has been removed since it no longer makes sense to keep (it was introduced as an escape hatch for 20.2 release). Note that we don't need to bump the distsql version because of this change since it is backwards compatible - if the gateway is running the old version that has `vectorize=201auto` set, then we will check whether flows for all nodes don't have non-streaming operators and possibly use `off` option on the flow setup request, then the newer version remote node will check the vectorize setting on the request whether it is not `off` and setup the vectorized flow if it is not. Release note (sql change): `201auto` value for `vectorize` session variable and the corresponding cluster setting has been removed. 55982: roachtest: use IMPORT for all TPC-C tests r=nvanbenschoten a=nvanbenschoten Fixes #55541. Fixes #55580. In #54880 and #55050, we switched to using IMPORT for most TPC-C tests, in favor of BACKUP, which requires fixtures to be regenerated whenever we changed the workload. In this PR, we switch over the remaining uses of `fixtures load tpcc` to `fixtures import tpcc` to avoid compatibility issues on older release branches. 55994: settings: delete StateMachineSetting, introduce VersionSetting r=irfansharif a=irfansharif We introduced the custom StateMachineSetting type in #17216 to power the underlying machinery for version upgrades: SET CLUSTER SETTING version = <major>-<minor>; At the time we left it generalizable enough to make room for future settings with arbitrary internal transitions. For cluster versions this meant only allowing transitions from one major version to the immediate next, all the while making sure that each binary in the cluster was able to activate the targeted version (the proposed version fell within the allowable range ["binary min supported version", "binary version"]). In the three years since we haven't added any state-machine validated settings that fit the bill, and the layers of abstractions to get to validated cluster version updates are one too many for (my) comfort. This PR introduces a new VersionSetting type that is more tightly coupled with the ClusterVersion type itself. VersionSetting uses language that only appropriate for cluster versions, hopefully clarifying things as we go. We'll depend on this clarification in future PRs when we remove the use of gossip in disseminating cluster version bumps. Release note (sql/cli change): The underlying type for the version cluster setting has been changed. Previously it was of an internal type representing "state machine", but now it's simply "version". This has no operational implications, but it does reflect differently in a few spots: - The `Type` column in `cockroach gen settings-list` will now show "version" instead of "custom validation" - The `setting_type` column for `version` in `SHOW CLUSTER SETTINGS` will now show a "v" instead of an "m" - The `valueType` column for `version` in `system.settings` will now show a "v" instead of an "m" 56006: logictest: deflake a test r=yuzefovich a=yuzefovich We've recently merged a test that in very rare circumstances could produce a float result that differs from the expected one by 1 in the 15th significant digit (after rounding). I believe that could occur, e.g. when the 15th and 16th significant digits were `35`, and we matched the spec of supporting 15 significant digits for floats, yet the rounding makes us return an unexpected result. This commit rounds to the precision of 1 digit less which should make the test non-flaky. Release note: None Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com> Co-authored-by: Nathan VanBenschoten <nvanbenschoten@gmail.com> Co-authored-by: irfan sharif <irfanmahmoudsharif@gmail.com>
Implement (hopefully) more than 50% of the migration RFC1. Specifically,
settingspackageSET CLUSTER SETTING version = '<major>.minor'*ExposedClusterVersionaround(*ExposedClusterVersion).IsActive(targetVersion)to toggle existingfeatures that so far used the stub
util.IsMigrated()util.IsMigrated().The missing part is incorporating the remaining parts of 2, that is, storing
the seen version to disk.