Skip to content

Commit

Permalink
Merge pull request #19263 from ahrtr/cluster_ver_20250123
Browse files Browse the repository at this point in the history
Remove the code of checking ClusterVersionSet in MinimalEtcdVersion
  • Loading branch information
ahrtr authored Jan 24, 2025
2 parents e289ba3 + 3e5e79d commit 1c840f8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 30 deletions.
11 changes: 5 additions & 6 deletions server/storage/schema/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"go.uber.org/zap"

"go.etcd.io/etcd/api/v3/etcdserverpb"
"go.etcd.io/etcd/api/v3/membershippb"
"go.etcd.io/etcd/api/v3/version"
"go.etcd.io/etcd/server/v3/storage/backend"
betesting "go.etcd.io/etcd/server/v3/storage/backend/testing"
Expand Down Expand Up @@ -181,17 +180,17 @@ func TestMigrate(t *testing.T) {
},
expectVersion: nil,
},
/* TODO: add a dedicated request for testing only to cover such case
{
name: "Downgrading v3.6 to v3.5 fails if there are newer WAL entries",
name: "Downgrading v3.6 to v3.5 works even if there is ClusterVersionSetRequest WAL entries with 3.6 clusterVersion",
version: version.V3_6,
targetVersion: version.V3_5,
walEntries: []etcdserverpb.InternalRaftRequest{
{ClusterVersionSet: &membershippb.ClusterVersionSetRequest{Ver: "3.6.0"}},
},
expectVersion: &version.V3_6,
expectError: true,
expectErrorMsg: "cannot downgrade storage, WAL contains newer entries",
},
expectVersion: nil, // 3.5 doesn't have field `storageVersion`, so it should be nil.
expectError: false,
},*/
{
name: "Downgrading v3.5 to v3.4 is not supported as schema was introduced in v3.6",
version: version.V3_5,
Expand Down
10 changes: 0 additions & 10 deletions server/storage/wal/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,6 @@ func visitEntryData(entryType raftpb.EntryType, data []byte, visitor Visitor) er
break
}
msg = proto.MessageReflect(&raftReq)
if raftReq.ClusterVersionSet != nil {
ver, err := semver.NewVersion(raftReq.ClusterVersionSet.Ver)
if err != nil {
return err
}
err = visitor(msg.Descriptor().FullName(), ver)
if err != nil {
return err
}
}
case raftpb.EntryConfChange:
var confChange raftpb.ConfChange
err := pbutil.Unmarshaler(&confChange).Unmarshal(data)
Expand Down
13 changes: 0 additions & 13 deletions server/storage/wal/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ func TestEtcdVersionFromEntry(t *testing.T) {
raftReq := etcdserverpb.InternalRaftRequest{Header: &etcdserverpb.RequestHeader{AuthRevision: 1}}
normalRequestData := pbutil.MustMarshal(&raftReq)

clusterVersionV3_6Req := etcdserverpb.InternalRaftRequest{ClusterVersionSet: &membershippb.ClusterVersionSetRequest{Ver: "3.6.0"}}
clusterVersionV3_6Data := pbutil.MustMarshal(&clusterVersionV3_6Req)

confChange := raftpb.ConfChange{Type: raftpb.ConfChangeAddLearnerNode}
confChangeData := pbutil.MustMarshal(&confChange)

Expand All @@ -59,16 +56,6 @@ func TestEtcdVersionFromEntry(t *testing.T) {
},
expect: &version.V3_1,
},
{
name: "Setting cluster version implies version within",
input: raftpb.Entry{
Term: 1,
Index: 2,
Type: raftpb.EntryNormal,
Data: clusterVersionV3_6Data,
},
expect: &version.V3_6,
},
{
name: "Using ConfigChange implies v3.0",
input: raftpb.Entry{
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/utl_wal_version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func TestEtcdVersionFromWAL(t *testing.T) {
if err != nil {
t.Fatal(err)
}
assert.Equal(t, &semver.Version{Major: 3, Minor: 6}, walVersion.MinimalEtcdVersion())
assert.Equal(t, &semver.Version{Major: 3, Minor: 5}, walVersion.MinimalEtcdVersion())
}

func waitForClusterVersionReady(srv *embed.Etcd) error {
Expand Down

0 comments on commit 1c840f8

Please sign in to comment.