Skip to content

Commit

Permalink
Merge pull request #41935 from andreimatei/19.2-version19.2
Browse files Browse the repository at this point in the history
settings/cluster: introducing the 19.2 cluster version
  • Loading branch information
andreimatei authored Oct 28, 2019
2 parents 80399cb + d179047 commit bad8e55
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/generated/settings/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,6 @@
<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>
<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>
<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>
<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>
<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>
</tbody>
</table>
28 changes: 26 additions & 2 deletions pkg/server/version_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,35 @@ func setupMixedCluster(
}

// Prev returns the previous version of the given version.
// eg. prev(2.0) = 1.0, prev(2.1) == 2.0, prev(2.1-5) == 2.1.
// eg. prev(20.1) = 19.2, prev(19.2) = 19.1, prev(19.1) = 2.1,
// prev(2.0) = 1.0, prev(2.1) == 2.0, prev(2.1-5) == 2.1.
func prev(version roachpb.Version) roachpb.Version {
if version.Unstable != 0 {
return roachpb.Version{Major: version.Major, Minor: version.Minor}
} else if version.Minor != 0 {
}

v19_1 := roachpb.Version{Major: 19, Minor: 1}

if v19_1.Less(version) {
if version.Minor > 1 {
return roachpb.Version{Major: version.Major, Minor: version.Minor - 1}
}
// Here we assume that there's going to only be 2 releases per year.
// Otherwise we'd need to keep some history of what releases we've had.
return roachpb.Version{Major: version.Major - 1, Minor: 2}
}

if version == v19_1 {
return roachpb.Version{Major: 2, Minor: 1}
}

// Logic for versions below 19.1.

if version.Major > 2 {
log.Fatalf(context.TODO(), "can't compute previous version for %s", version)
}

if version.Minor != 0 {
return roachpb.Version{Major: version.Major}
} else {
// version will be at least 2.0-X, so it's safe to set new Major to be version.Major-1.
Expand Down
6 changes: 6 additions & 0 deletions pkg/settings/cluster/cockroach_versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const (
VersionAtomicChangeReplicas
VersionTableDescModificationTimeFromMVCC
VersionPartitionedBackup
Version19_2

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

Expand Down Expand Up @@ -551,6 +552,11 @@ var versionsSingleton = keyedVersions([]keyedVersion{
Key: VersionPartitionedBackup,
Version: roachpb.Version{Major: 19, Minor: 1, Unstable: 11},
},
{
// Version19_2 is CockroachDB v19.2. It's used for all v19.2.x patch releases.
Key: Version19_2,
Version: roachpb.Version{Major: 19, Minor: 2},
},

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

Expand Down
2 changes: 2 additions & 0 deletions pkg/settings/cluster/cockroach_versions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
)

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

require.NoError(t, versionsSingleton.Validate())
Expand Down
5 changes: 3 additions & 2 deletions pkg/settings/cluster/versionkey_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/sql/logictest/testdata/logic_test/crdb_internal
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ select crdb_internal.set_vmodule('')
query T
select regexp_replace(crdb_internal.node_executable_version()::string, '(-\d+)?$', '');
----
19.1
19.2

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

user root

Expand Down

0 comments on commit bad8e55

Please sign in to comment.