Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion api/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
var (
// MinClusterVersion is the min cluster version this etcd binary is compatible with.
MinClusterVersion = "3.0.0"
Version = "3.6.0-alpha.0"
Version = "3.7.0-alpha.0"
APIVersion = "unknown"

// Git SHA Value will be set during build
Expand All @@ -43,6 +43,7 @@ var (
V3_5 = semver.Version{Major: 3, Minor: 5}
V3_6 = semver.Version{Major: 3, Minor: 6}
V3_7 = semver.Version{Major: 3, Minor: 7}
V3_8 = semver.Version{Major: 3, Minor: 8}
V4_0 = semver.Version{Major: 4, Minor: 0}

// AllVersions keeps all the versions in ascending order.
Expand Down
2 changes: 1 addition & 1 deletion etcdutl/snapshot/v3_snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestSnapshotStatus(t *testing.T) {
status, err := NewV3(zap.NewNop()).Status(dbpath)
require.NoError(t, err)

assert.Equal(t, uint32(0x62132b4d), status.Hash)
assert.Equal(t, uint32(0xe7a6e44b), status.Hash)
assert.Equal(t, int64(11), status.Revision)
}

Expand Down
1 change: 1 addition & 0 deletions server/etcdserver/api/capability.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ var (
"3.4.0": {AuthCapability: true, V3rpcCapability: true},
"3.5.0": {AuthCapability: true, V3rpcCapability: true},
"3.6.0": {AuthCapability: true, V3rpcCapability: true},
"3.7.0": {AuthCapability: true, V3rpcCapability: true},
}

enableMapMu sync.RWMutex
Expand Down
1 change: 1 addition & 0 deletions server/etcdserver/api/rafthttp/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ var (
"3.4.0": {streamTypeMsgAppV2, streamTypeMessage},
"3.5.0": {streamTypeMsgAppV2, streamTypeMessage},
"3.6.0": {streamTypeMsgAppV2, streamTypeMessage},
"3.7.0": {streamTypeMsgAppV2, streamTypeMessage},
}
)

Expand Down
2 changes: 1 addition & 1 deletion server/etcdserver/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func mockBootstrapRoundTrip(members []etcdserverpb.Member) roundTripFunc {
case strings.Contains(r.URL.String(), DowngradeEnabledPath):
return &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(strings.NewReader(`true`)),
Body: io.NopCloser(strings.NewReader(`false`)),
}, nil
}
return nil, nil
Expand Down
13 changes: 9 additions & 4 deletions server/storage/schema/migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,16 @@ func TestNewPlan(t *testing.T) {
target: version.V3_5,
},
{
name: "Upgrade v3.6 to v3.7 should fail as v3.7 is unknown",
current: version.V3_6,
target: version.V3_7,
name: "Upgrade v3.6 to v3.7 should work",
current: version.V3_6,
target: version.V3_7,
},
{
name: "Upgrade v3.7 to v3.8 should fail as v3.8 is unknown",
current: version.V3_7,
target: version.V3_8,
expectError: true,
expectErrorMsg: `version "3.7.0" is not supported`,
expectErrorMsg: `version "3.8.0" is not supported`,
},
{
name: "Upgrade v3.6 to v4.0 as major version changes are unsupported",
Expand Down
1 change: 1 addition & 0 deletions server/storage/schema/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ var (
version.V3_6: {
addNewField(Meta, MetaStorageVersionName, emptyStorageVersion),
},
version.V3_7: {},
}
// emptyStorageVersion is used for v3.6 Step for the first time, in all other version StoragetVersion should be set by migrator.
// Adding a addNewField for StorageVersion we can reuse logic to remove it when downgrading to v3.5
Expand Down
45 changes: 33 additions & 12 deletions server/storage/schema/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,14 @@ func TestValidate(t *testing.T) {
version: version.V3_6,
},
{
name: `V3.7 schema is unknown and should return error`,
version: version.V3_7,
name: `V3.7 is correct`,
version: version.V3_7,
},
{
name: `V3.8 schema is unknown and should return error`,
version: version.V3_8,
expectError: true,
expectErrorMsg: `version "3.7.0" is not supported`,
expectErrorMsg: `version "3.8.0" is not supported`,
},
}
for _, tc := range tcs {
Expand Down Expand Up @@ -157,20 +161,32 @@ func TestMigrate(t *testing.T) {
expectVersion: &version.V3_7,
},
{
name: "Upgrading 3.6 to v3.7 is not supported",
version: version.V3_6,
targetVersion: version.V3_7,
expectVersion: &version.V3_6,
expectError: true,
expectErrorMsg: `cannot create migration plan: version "3.7.0" is not supported`,
name: "Upgrading 3.6 to v3.7 should work",
version: version.V3_6,
targetVersion: version.V3_7,
expectVersion: &version.V3_7,
},
{
name: "Downgrading v3.7 to v3.6 is not supported",
name: "Upgrading 3.7 to v3.8 is not supported",
version: version.V3_7,
targetVersion: version.V3_6,
targetVersion: version.V3_8,
expectVersion: &version.V3_7,
expectError: true,
expectErrorMsg: `cannot create migration plan: version "3.7.0" is not supported`,
expectErrorMsg: `cannot create migration plan: version "3.8.0" is not supported`,
},
{
name: "Downgrading v3.7 to v3.6 should work",
version: version.V3_7,
targetVersion: version.V3_6,
expectVersion: &version.V3_6,
},
{
name: "Downgrading v3.8 to v3.7 is not supported",
version: version.V3_8,
targetVersion: version.V3_7,
expectVersion: &version.V3_8,
expectError: true,
expectErrorMsg: `cannot create migration plan: version "3.8.0" is not supported`,
},
{
name: "Downgrading v3.6 to v3.5 works as there are no v3.6 wal entries",
Expand Down Expand Up @@ -319,6 +335,11 @@ func setupBackendData(t *testing.T, ver semver.Version, overrideKeys func(tx bac
UnsafeUpdateConsistentIndex(tx, 1, 1)
UnsafeSetStorageVersion(tx, &version.V3_7)
tx.UnsafePut(Meta, []byte("future-key"), []byte(""))
case version.V3_8:
MustUnsafeSaveConfStateToBackend(zap.NewNop(), tx, &raftpb.ConfState{})
UnsafeUpdateConsistentIndex(tx, 1, 1)
UnsafeSetStorageVersion(tx, &version.V3_8)
tx.UnsafePut(Meta, []byte("future-key"), []byte(""))
default:
t.Fatalf("Unsupported storage version")
}
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/ctl_v3_snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ func snapshotVersionTest(cx ctlCtx) {
if err != nil {
cx.t.Fatalf("snapshotVersionTest getSnapshotStatus error (%v)", err)
}
if st.Version != "3.6.0" {
cx.t.Fatalf("expected %q, got %q", "3.6.0", st.Version)
if st.Version != "3.7.0" {
cx.t.Fatalf("expected %q, got %q", "3.7.0", st.Version)
}
}

Expand Down
100 changes: 0 additions & 100 deletions tests/e2e/discovery_test.go

This file was deleted.

57 changes: 29 additions & 28 deletions tests/e2e/utl_migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,78 +54,79 @@ func TestEtctlutlMigrate(t *testing.T) {
targetVersion: "abc",
clusterSize: 1,
expectLogsSubString: `Error: wrong target version format, expected "X.Y", got "abc"`,
expectStorageVersion: &version.V3_6,
expectStorageVersion: &version.V3_7,
},
{
name: "Invalid target version",
targetVersion: "3.a",
clusterSize: 1,
expectLogsSubString: `Error: failed to parse target version: strconv.ParseInt: parsing "a": invalid syntax`,
expectStorageVersion: &version.V3_6,
expectStorageVersion: &version.V3_7,
},
{
name: "Target with only major version is invalid",
targetVersion: "3",
clusterSize: 1,
expectLogsSubString: `Error: wrong target version format, expected "X.Y", got "3"`,
expectStorageVersion: &version.V3_6,
expectStorageVersion: &version.V3_7,
},
{
name: "Target with patch version is invalid",
targetVersion: "3.6.0",
clusterSize: 1,
expectLogsSubString: `Error: wrong target version format, expected "X.Y", got "3.6.0"`,
expectStorageVersion: &version.V3_6,
expectStorageVersion: &version.V3_7,
},
{
name: "Migrate v3.5 to v3.5 is no-op",
clusterVersion: e2e.LastVersion,
clusterSize: 1,
targetVersion: "3.5",
expectLogsSubString: "storage version up-to-date\t" + `{"storage-version": "3.5"}`,
name: "Migrate v3.6 to v3.6 is no-op",
clusterVersion: e2e.LastVersion,
clusterSize: 1,
targetVersion: "3.6",
expectStorageVersion: &version.V3_6,
expectLogsSubString: "storage version up-to-date\t" + `{"storage-version": "3.6"}`,
},
{
name: "Upgrade 1 member cluster from v3.5 to v3.6 should work",
clusterVersion: e2e.LastVersion,
clusterSize: 1,
targetVersion: "3.6",
expectStorageVersion: &version.V3_6,
targetVersion: "3.7",
expectStorageVersion: &version.V3_7,
},
{
name: "Upgrade 3 member cluster from v3.5 to v3.6 should work",
name: "Upgrade 3 member cluster from v3.6 to v3.7 should work",
clusterVersion: e2e.LastVersion,
clusterSize: 3,
targetVersion: "3.6",
expectStorageVersion: &version.V3_6,
targetVersion: "3.7",
expectStorageVersion: &version.V3_7,
},
{
name: "Migrate v3.6 to v3.6 is no-op",
targetVersion: "3.6",
name: "Migrate v3.7 to v3.7 is no-op",
targetVersion: "3.7",
clusterSize: 1,
expectLogsSubString: "storage version up-to-date\t" + `{"storage-version": "3.6"}`,
expectStorageVersion: &version.V3_6,
expectLogsSubString: "storage version up-to-date\t" + `{"storage-version": "3.7"}`,
expectStorageVersion: &version.V3_7,
},
{
name: "Downgrade 1 member cluster from v3.6 to v3.5 should work",
targetVersion: "3.5",
name: "Downgrade 1 member cluster from v3.7 to v3.6 should work",
targetVersion: "3.6",
clusterSize: 1,
expectLogsSubString: "updated storage version",
expectStorageVersion: nil, // 3.5 doesn't have the field `storageVersion`, so it returns nil.
expectStorageVersion: &version.V3_6,
},
{
name: "Downgrade 3 member cluster from v3.6 to v3.5 should work",
targetVersion: "3.5",
name: "Downgrade 3 member cluster from v3.7 to v3.6 should work",
targetVersion: "3.6",
clusterSize: 3,
expectLogsSubString: "updated storage version",
expectStorageVersion: nil, // 3.5 doesn't have the field `storageVersion`, so it returns nil.
expectStorageVersion: &version.V3_6,
},
{
name: "Upgrade v3.6 to v3.7 with force should work",
targetVersion: "3.7",
name: "Upgrade v3.7 to v3.8 with force should work",
targetVersion: "3.8",
clusterSize: 1,
force: true,
expectLogsSubString: "forcefully set storage version\t" + `{"storage-version": "3.7"}`,
expectStorageVersion: &semver.Version{Major: 3, Minor: 7},
expectLogsSubString: "forcefully set storage version\t" + `{"storage-version": "3.8"}`,
expectStorageVersion: &semver.Version{Major: 3, Minor: 8},
},
}
for _, tc := range tcs {
Expand Down
Loading