Skip to content
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

clusterversion: change string for upgrade versions #115223

Merged
merged 2 commits into from Dec 1, 2023

Conversation

RaduBerinde
Copy link
Member

@RaduBerinde RaduBerinde commented Nov 29, 2023

clusterversion: move ReleaseSeries functionality to roacphb.Version

This change moves the implementation of
clusterversion.Key.ReleaseSeries() to roachpb. We now use a
hardcoded map of sucessor versions.

Epic: none
Release note: None

clusterversion: change string for upgrade versions

This change concerns cluster versions during upgrade. When starting an
upgrade from e.g. 23.3 to 24.1, we start with the cluster version 23.2
and then we go through a sequence of internal versions associated with
various upgrade steps. These versions are presented as 23.2-x, e.g.
23.2-8.

This formatting doesn't make it clear what this version represents. It
can also be confusing - 23.2-8 looks very close to 23.2.8 which
might be an actual CockroachDB version.

This change renames versions during upgrade:
23.2-upgrading-to-24.1-step-008. The internal part is always
formatted to three digits (this is intended to reduce the chance of
confusing the internal part to a patch release).

Informs: #112629
Release note (general change): Versions during upgrades are renamed,
for example 23.2-8 is now 23.2-upgrading-to-24.1-step-008.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@RaduBerinde RaduBerinde force-pushed the upgrade-ver-str branch 3 times, most recently from 29ed41f to 2909a9a Compare November 30, 2023 13:07
@RaduBerinde RaduBerinde requested a review from dt November 30, 2023 13:21
@RaduBerinde RaduBerinde marked this pull request as ready for review November 30, 2023 13:21
@RaduBerinde RaduBerinde requested review from a team as code owners November 30, 2023 13:21
@RaduBerinde RaduBerinde requested review from herkolategan and DarrylWong and removed request for a team November 30, 2023 13:21
@RaduBerinde
Copy link
Member Author

Open to suggestions if there's something better than upgrade-step. Ideally something that would give more of a hint that we're upgrading from the xx.y prefix, and not to it.

@dt
Copy link
Member

dt commented Nov 30, 2023

I'm not sure but upgrading might have a slightly more accurate implication than upgrade?

if I say "22.2 upgraded step 8" in my head that means the 8th step of the "22.2 upgrade". Of course we both know it is the 22.2 to 23.1 upgrade, but that is lost there. If someone said "22.2 upgrading step 8" I think it could sound like it is either to OR from -- it isn't obviously from in my mind, but seems less obviously (and incorrectly) to? Maybe that's just me though.

But I think we could do better if we wanted to: we can put whatever string we want between these parts - it isn't meaningful to the computer. That means we could put the version we're going to in there too, e.g. 22.2-upgrading-to-23.1-step-08.

You might say "but we don't know we're upgrading to 23.1" but we do actually: we only define step 08 in a 23.1 binary, so we know by that point the name of the version we're headed to. We could make a little map in this package called successors = map[Version]ClusterVersion{ {Major:22, Minor: 2} : V23_1, ...} and then this String() method could do something like

if succ, ok := successors[Verison{Major: v.Major, Minor: v.Minor}]; ok { 
  return fmt.Sprintf("%d.%d-upgrading-to-%s-step-%03d", v.Major, v.Minor, succ, v.Internal)
} 
return fmt.Sprintf("%d.%d-upgrading-step-%03d", v.Major, v.Minor, succ, v.Internal)

That said, this is more complicated, and putting literally anything other than just - here would make the situation better than it is now, so a static string upgrade-step or upgrading-step seems like a strict improvement too.

@RaduBerinde
Copy link
Member Author

Very cool idea. I already added something along those lines that in clusterversion: https://github.com/cockroachdb/cockroach/blob/master/pkg/clusterversion/cockroach_versions.go#L430

We can't depend on clusterversion from roachpb. I think the best way is to generate the code for the map as part of dev gen go

@dt
Copy link
Member

dt commented Nov 30, 2023

generate the code for the map as part of dev gen go

Ehhhh; it's a single-digit entry count map. I'd just hand-write it in roachpb/version.go and then change that code in clusterversion to call in to the map instead of deriving it on the fly. If we're worried about rot we can add a tiny unit test in clusterversion that just compares IsFinal to the map entries. Adding a generation step for this feels like overkill / slow build times /2¢.

@RaduBerinde
Copy link
Member Author

Oh, good point. Yes I agree, we can move the current logic to a test as a cross-check. Nice!

@RaduBerinde
Copy link
Member Author

Done!

Copy link
Member Author

@RaduBerinde RaduBerinde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @DarrylWong, @dt, and @herkolategan)


docs/generated/settings/settings.html line 279 at r2 (raw file):

<tr><td><div id="setting-trace-zipkin-collector" class="anchored"><code>trace.zipkin.collector</code></div></td><td>string</td><td><code></code></td><td>the address of a Zipkin instance to receive traces, as &lt;host&gt;:&lt;port&gt;. If no port is specified, 9411 will be used.</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
<tr><td><div id="setting-ui-display-timezone" class="anchored"><code>ui.display_timezone</code></div></td><td>enumeration</td><td><code>etc/utc</code></td><td>the timezone used to format timestamps in the ui [etc/utc = 0, america/new_york = 1]</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
<tr><td><div id="setting-version" class="anchored"><code>version</code></div></td><td>version</td><td><code>1000023.2-upgrading-step-002</code></td><td>set the active cluster version in the format &#39;&lt;major&gt;.&lt;minor&gt;&#39;</td><td>Serverless/Dedicated/Self-Hosted</td></tr>

This is because of the dev offset.. I could move the DevOffset constant there and remove it if necessary.. but it will still look weird: 1000023.2-upgrading-to-24.1-step-002.

@RaduBerinde RaduBerinde force-pushed the upgrade-ver-str branch 2 times, most recently from 753b95a to afbe5ac Compare November 30, 2023 21:04
Copy link
Member Author

@RaduBerinde RaduBerinde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @DarrylWong, @dt, and @herkolategan)


docs/generated/settings/settings.html line 279 at r2 (raw file):

Previously, RaduBerinde wrote…

This is because of the dev offset.. I could move the DevOffset constant there and remove it if necessary.. but it will still look weird: 1000023.2-upgrading-to-24.1-step-002.

Never mind, I made it work.

@RaduBerinde RaduBerinde force-pushed the upgrade-ver-str branch 2 times, most recently from 54bdeb8 to 14f57af Compare December 1, 2023 01:54
Copy link
Member

@dt dt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@RaduBerinde
Copy link
Member Author

TFTR!

bors r+

@RaduBerinde
Copy link
Member Author

bors r-

@craig
Copy link
Contributor

craig bot commented Dec 1, 2023

Canceled.

This change moves the implementation of
`clusterversion.Key.ReleaseSeries()` to `roachpb`. We now use a
hardcoded map of sucessor versions.

Epic: none
Release note: None
This change concerns cluster versions during upgrade. When starting an
upgrade from e.g. 23.3 to 24.1, we start with the cluster version 23.2
and then we go through a sequence of internal versions associated with
various upgrade steps. These versions are presented as `23.2-x`, e.g.
`23.2-8`.

This formatting doesn't make it clear what this version represents. It
can also be confusing - `23.2-8` looks very close to `23.2.8` which
might be an actual CockroachDB version.

This change renames versions during upgrade:
`23.2-upgrading-to-24.1-step-008`. The internal part is always
formatted to three digits (this is intended to reduce the chance of
confusing the internal part to a patch release).

Informs: cockroachdb#112629
Release note (general change): Versions during upgrades are renamed,
for example `23.2-8` is now `23.2-upgrading-to-24.1-step-008`.
@RaduBerinde
Copy link
Member Author

bors r+

@craig
Copy link
Contributor

craig bot commented Dec 1, 2023

Build succeeded:

@craig craig bot merged commit 19ce36d into cockroachdb:master Dec 1, 2023
8 of 9 checks passed
stevendanna added a commit to stevendanna/cockroach that referenced this pull request Dec 8, 2023
In cockroachdb#115223 we improved the string representation of internal
versions. This test, however, gets an error generated from a node on
an older version that uses the older string format.

Here, I change the assertion to match on only part of the error
message which is enough to assert that the correct node is reporting
it is on an older version.

Fixes cockroachdb#115502

Release note: None
craig bot pushed a commit that referenced this pull request Dec 14, 2023
115864: roachtest: loosely match error in multitenant-upgrade r=yuzefovich a=stevendanna

In #115223 we improved the string representation of internal versions. This test, however, gets an error generated from a node on an older version that uses the older string format.

Here, I change the assertion to match on only part of the error message which is enough to assert that the correct node is reporting it is on an older version.

Fixes #115502

Release note: None

Co-authored-by: Steven Danna <danna@cockroachlabs.com>
renatolabs added a commit to renatolabs/cockroach that referenced this pull request May 3, 2024
We keep track of sql instances in multi-tenant deployments using the
`system.sql_instances` table. One of the columns in this table is
`binary_version`: this is the encoding of the version that the sql
instance is running. SQL instances know how to reach each other by
reading from that table (more accurately, setting up a rangefeed on
that table and updating a local cache).

In cockroachdb#115223, we introduced a new, more understandable string
representation of cockroach internal versions. This new format is,
however, backwards incompatible: older releases of cockroach are not
able to parse it. As a result, a mixed-version multi-tenant
deployments may face errors if some of the instances are running an
internal version: the older releases won't be able to parse the new
version format. As a result, the cache will be stale and we might see
query errors and distsql timeouts.

In this commit, we introduce a backwards compatible implementation of
the the string representation of a version. Specifically, we continue
to use the old format if the minimum supported version is less than
24.1 (the version in which the new formatting was added). This commit
should eventually be reverted when we no longer support versions older
than 24.1.

Epic: none

Release note: None
renatolabs added a commit to renatolabs/cockroach that referenced this pull request May 3, 2024
We keep track of sql instances in multi-tenant deployments using the
`system.sql_instances` table. One of the columns in this table is
`binary_version`: this is the encoding of the version that the sql
instance is running. SQL instances know how to reach each other by
reading from that table (more accurately, setting up a rangefeed on
that table and updating a local cache).

In cockroachdb#115223, we introduced a new, more understandable string
representation of cockroach internal versions. This new format is,
however, backwards incompatible: older releases of cockroach are not
able to parse it. As a result, a mixed-version multi-tenant
deployments may face errors if some of the instances are running an
internal version: the older releases won't be able to parse the new
version format. As a result, the cache will be stale and we might see
query errors and distsql timeouts.

In this commit, we introduce a backwards compatible implementation of
the the string representation of a version. Specifically, we continue
to use the old format if the minimum supported version is less than
24.1 (the version in which the new formatting was added). This commit
should eventually be reverted when we no longer support versions older
than 24.1.

Epic: none

Release note: None
craig bot pushed a commit that referenced this pull request May 6, 2024
123520: sqlinstance: write backwards compatible binary version r=RaduBerinde a=renatolabs

We keep track of sql instances in multi-tenant deployments using the
`system.sql_instances` table. One of the columns in this table is
`binary_version`: this is the encoding of the version that the sql
instance is running. SQL instances know how to reach each other by
reading from that table (more accurately, setting up a rangefeed on
that table and updating a local cache).

In #115223, we introduced a new, more understandable string
representation of cockroach internal versions. This new format is,
however, backwards incompatible: older releases of cockroach are not
able to parse it. As a result, a mixed-version multi-tenant
deployments may face errors if some of the instances are running an
internal version: the older releases won't be able to parse the new
version format. As a result, the cache will be stale and we might see
query errors and distsql timeouts.

In this commit, we introduce a backwards compatible implementation of
the the string representation of a version. Specifically, we continue
to use the old format if the minimum supported version is less than
24.1 (the version in which the new formatting was added). This commit
should eventually be reverted when we no longer support versions older
than 24.1.

Epic: none

Release note: None

Co-authored-by: Renato Costa <renato@cockroachlabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants