-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
roachtest: normalize versions in multitenant-upgrade roachtest #95904
Conversation
It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR? 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
c2918b8
to
dec3327
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.
pkg/sql/tenant_creation.go
Outdated
@@ -141,7 +139,6 @@ func (p *planner) createTenantInternal( | |||
// Use the previous major version to create the tenant and bootstrap it | |||
// just like the previous major version binary would, using hardcoded | |||
// initial values. | |||
tenantVersion.Version = clusterversion.ByKey(minVersion) |
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.
IIUC, this change does subtly alter what we're doing here. Before your change, we'd always initialize the tenant to a fully valid cluster version (as opposed to a cluster version which may be mid-way between two version, in the case of an in-progres upgrade). I'm not certain what's the right thing to do here, but I'd think that we wouldn't want to initialize to intermediate versions as we'd need to initialize the catalogs to that intermediate state as well, which seems difficult.
// Returns three versions : | ||
// - v0 corresponds to the bootstrapped version of the tenant, | ||
// - v1, v2 correspond to adjacent releases. | ||
// Returns two versions v0, v1, v2 which correspond to adjacent releases. v0 will |
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.
Is this change future-proof? If, for example, we let MinSupportedVerion trail a few releases, would this comment still be correct? I'd imagine that the test would still do what we'd want it to do, though maybe not if we wanted to test all of the upgrade stages in between v0 and v2.
I agree maybe this is not the right change, maybe we should make the changes to how we test instead? I am looking for suggestions but I will leave 2 points on why I made this change to further explain how this is just a testing issue and not an actual correctness issue:
|
aaa4bed
to
452c5ee
Compare
When multiple previous releases are supported, my previous code change becomes incorrect. I removed my changes to Ready for another pass. |
Drive-by comment about upgrade testing here: If we decide to merge this PR as it currently is, I'd suggest adding a note/TODO/issue to revert it at some point. I think we can agree that asserting on specific cluster versions makes for a stronger test (and having or not having the version offset is part of that); more importantly, we want to eventually live in a world where most upgrade roachtests don't have to deal with version offsetting (#92608). I'd also make a small correction here that version offsetting does not depend on the cockroach/pkg/clusterversion/cockroach_versions.go Lines 712 to 717 in 3e65660
|
What should the trigger of this revert be? Is there something expected after which we won't need to normalize versions?
👍 |
Once #92608 is closed. |
52b9f19
to
1cb4e12
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.
I like this change much better than the initial one, but it's not clear to me that it's what we want long-term. I'd think that the long-term fix here is to ensure that the create tenant code respects the version overrides contained in the testing knobs. That way we won't need the offset ignoring code. I'm OK to merge this now if we plan to add the testing knobs fix in a separate PR.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @healthy-pod, @knz, @postamar, @smg260, and @srosenberg)
pkg/cmd/roachtest/tests/multitenant_upgrade.go
line 315 at r2 (raw file):
) { normalizeVersion := func(v roachpb.Version) roachpb.Version { if (v.Major - clusterversion.DevOffset) >= 0 {
Nit: it might beeasier to understand this code if it was written as:
if v.Major > clusterversion.DevOffset {
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 added the tenant logical version overrides in #94973, this is not related to that. Previously (ie before #94774) we used to set the tenant logical version to be exactly the storage logical version. As in, we read the SLV and set the TLV to that. Now this is not true, it's either the SBV if it's equal to the SLV or otherwise the min version the storage binary can use to create a tenant. What happens here is:
current binary = non-release binary with version offset
predecessor binary = release binary without version offset
- storage starts with
predecessor binary
and its logical version ispredecessor binary
so SLV doesn't have offset - storage upgrades to
current binary
but doesn't finalize so SLV is still without offset - storage binary now though is
current binary
which is non-release and when it "calculates" the tenant creation version (instead of what used to happen previously which was just copying SLV) it will be the min supported version ofcurrent binary
which happens to bepredecessor binary
but with offset because current binary is not a release binary even if storage didn't finalize yet.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @knz, @postamar, @smg260, and @srosenberg)
If the multitenant-upgrade roachtest uses a mix of release/non-release binaries, it may be using versions that are technically the same but fail to confirm that because version in test binaries are incremented by 1M. This code change fixes the issue by normalizing versions before comparing them. Closes cockroachdb#95648 Epic: none Release note: None
bors r=ajstorm |
Build succeeded: |
This commit adds a new environment variable that can be used by tests to force a development binary to treated as a release binary: `COCKROACH_TESTING_FORCE_RELEASE_BRANCH`. Previously, upgrade roachtests were setting the `COCKROACH_UPGRADE_TO_DEV_VERSION` variable to allow `master` to be deployed during tests. The main downside of this approach is that it is not the logic that real cluster would run when upgrading. In addition, it could lead to upgrades that seem to go "backwards", which can be quite confusing. With this change, upgrade roachtests bypass the version offsetting logic and are treated as the "next release" during tests. This commit also reverts cockroachdb#95904, as the workaround introduced there is no longer necessary. Resolves: cockroachdb#92608. Epic: CRDB-19321 Release note: None
97595: clusterversion: allow tests to pretend to be a release branch r=srosenberg a=renatolabs This commit adds a new environment variable that can be used by tests to force a development binary to treated as a release binary: `COCKROACH_TESTING_FORCE_RELEASE_BRANCH`. Previously, upgrade roachtests were setting the `COCKROACH_UPGRADE_TO_DEV_VERSION` variable to allow `master` to be deployed during tests. The main downside of this approach is that it is not the logic that real cluster would run when upgrading. In addition, it could lead to upgrades that seem to go "backwards", which can be quite confusing. With this change, upgrade roachtests bypass the version offsetting logic and are treated as the "next release" during tests. This commit also reverts #95904, as the workaround introduced there is no longer necessary. Resolves: #92608. Epic: CRDB-19321 Release note: None Co-authored-by: Renato Costa <[email protected]>
If the multitenant-upgrade roachtest uses a mix
of release/non-release binaries, it may be using versions
that are technically the same but fail to confirm that because
version in test binaries are incremented by 1M.
This code change fixes the issue by normalizing versions before
comparing them.
Closes #95648
Epic: none
Release note: None