Skip to content

Commit d179047

Browse files
committed
settings/cluster: introducing the 19.2 cluster version
This is not a backport; it's original work on the release-19.2 branch. The corresponding work on master is #41931. I've had to skip a test because it was validating that we've removed all the versions introduced before 19.1, since they're now "always active". Work to remove those versions is in progress on master. Release note: None
1 parent 80399cb commit d179047

File tree

6 files changed

+40
-7
lines changed

6 files changed

+40
-7
lines changed

docs/generated/settings/settings.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,6 @@
134134
<tr><td><code>trace.debug.enable</code></td><td>boolean</td><td><code>false</code></td><td>if set, traces for recent requests can be seen in the /debug page</td></tr>
135135
<tr><td><code>trace.lightstep.token</code></td><td>string</td><td><code></code></td><td>if set, traces go to Lightstep using this token</td></tr>
136136
<tr><td><code>trace.zipkin.collector</code></td><td>string</td><td><code></code></td><td>if set, traces go to the given Zipkin instance (example: '127.0.0.1:9411'); ignored if trace.lightstep.token is set</td></tr>
137-
<tr><td><code>version</code></td><td>custom validation</td><td><code>19.1-11</code></td><td>set the active cluster version in the format '<major>.<minor>'</td></tr>
137+
<tr><td><code>version</code></td><td>custom validation</td><td><code>19.2</code></td><td>set the active cluster version in the format '<major>.<minor>'</td></tr>
138138
</tbody>
139139
</table>

pkg/server/version_cluster_test.go

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,35 @@ func setupMixedCluster(
134134
}
135135

136136
// Prev returns the previous version of the given version.
137-
// eg. prev(2.0) = 1.0, prev(2.1) == 2.0, prev(2.1-5) == 2.1.
137+
// eg. prev(20.1) = 19.2, prev(19.2) = 19.1, prev(19.1) = 2.1,
138+
// prev(2.0) = 1.0, prev(2.1) == 2.0, prev(2.1-5) == 2.1.
138139
func prev(version roachpb.Version) roachpb.Version {
139140
if version.Unstable != 0 {
140141
return roachpb.Version{Major: version.Major, Minor: version.Minor}
141-
} else if version.Minor != 0 {
142+
}
143+
144+
v19_1 := roachpb.Version{Major: 19, Minor: 1}
145+
146+
if v19_1.Less(version) {
147+
if version.Minor > 1 {
148+
return roachpb.Version{Major: version.Major, Minor: version.Minor - 1}
149+
}
150+
// Here we assume that there's going to only be 2 releases per year.
151+
// Otherwise we'd need to keep some history of what releases we've had.
152+
return roachpb.Version{Major: version.Major - 1, Minor: 2}
153+
}
154+
155+
if version == v19_1 {
156+
return roachpb.Version{Major: 2, Minor: 1}
157+
}
158+
159+
// Logic for versions below 19.1.
160+
161+
if version.Major > 2 {
162+
log.Fatalf(context.TODO(), "can't compute previous version for %s", version)
163+
}
164+
165+
if version.Minor != 0 {
142166
return roachpb.Version{Major: version.Major}
143167
} else {
144168
// version will be at least 2.0-X, so it's safe to set new Major to be version.Major-1.

pkg/settings/cluster/cockroach_versions.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const (
4646
VersionAtomicChangeReplicas
4747
VersionTableDescModificationTimeFromMVCC
4848
VersionPartitionedBackup
49+
Version19_2
4950

5051
// Add new versions here (step one of two).
5152

@@ -551,6 +552,11 @@ var versionsSingleton = keyedVersions([]keyedVersion{
551552
Key: VersionPartitionedBackup,
552553
Version: roachpb.Version{Major: 19, Minor: 1, Unstable: 11},
553554
},
555+
{
556+
// Version19_2 is CockroachDB v19.2. It's used for all v19.2.x patch releases.
557+
Key: Version19_2,
558+
Version: roachpb.Version{Major: 19, Minor: 2},
559+
},
554560

555561
// Add new versions here (step two of two).
556562

pkg/settings/cluster/cockroach_versions_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import (
1818
)
1919

2020
func TestVersionsAreValid(t *testing.T) {
21+
t.Skip("test skipped on the release 19.2 branch because we haven't " +
22+
"removed old migrations introduced in 19.1")
2123
defer leaktest.AfterTest(t)()
2224

2325
require.NoError(t, versionsSingleton.Validate())

pkg/settings/cluster/versionkey_string.go

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/sql/logictest/testdata/logic_test/crdb_internal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ select crdb_internal.set_vmodule('')
289289
query T
290290
select regexp_replace(crdb_internal.node_executable_version()::string, '(-\d+)?$', '');
291291
----
292-
19.1
292+
19.2
293293

294294
query ITTT colnames
295295
select node_id, component, field, regexp_replace(regexp_replace(value, '^\d+$', '<port>'), e':\\d+', ':<port>') as value from crdb_internal.node_runtime_info
@@ -442,7 +442,7 @@ select * from crdb_internal.gossip_alerts
442442
query T
443443
select regexp_replace(crdb_internal.node_executable_version()::string, '(-\d+)?$', '');
444444
----
445-
19.1
445+
19.2
446446

447447
user root
448448

0 commit comments

Comments
 (0)