Skip to content

Remove checking confState during schema migration #20494

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

Merged
merged 1 commit into from
Aug 15, 2025
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
14 changes: 5 additions & 9 deletions server/storage/schema/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,11 @@ func UnsafeDetectSchemaVersion(lg *zap.Logger, tx backend.UnsafeReader) (v semve
return *vp, nil
}

// TODO: remove the operations of reading the fields `confState`
// and `term` in 3.7. We only need to be back-compatible
// with 3.6 when we are running 3.7, and the `storageVersion`
// already exists in all versions >= 3.6, so we don't need to
// use any other fields to identify the etcd's storage version.
confstate := UnsafeConfStateFromBackend(lg, tx)
if confstate == nil {
return v, fmt.Errorf("missing confstate information")
}
// TODO: remove the operations of reading the field `term`
// in 3.7. We only need to be back-compatible with 3.6 when
// we are running 3.7, and the `storageVersion` already exists
// in all versions >= 3.6, so we don't need to use any other
// fields to identify the etcd's storage version.
_, term := UnsafeReadConsistentIndex(tx)
if term == 0 {
return v, fmt.Errorf("missing term information")
Expand Down
11 changes: 1 addition & 10 deletions server/storage/schema/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,7 @@ func TestMigrate(t *testing.T) {
expectErrorMsg string
}{
// As storage version field was added in v3.6, for v3.5 we will not set it.
// For storage to be considered v3.5 it have both confstate and term key set.
{
name: `Upgrading v3.5 to v3.6 should be rejected if confstate is not set`,
version: version.V3_5,
overrideKeys: func(tx backend.UnsafeReadWriter) {},
targetVersion: version.V3_6,
expectVersion: nil,
expectError: true,
expectErrorMsg: `cannot detect storage schema version: missing confstate information`,
},
// For storage to be considered v3.5 it has term key set.
{
name: `Upgrading v3.5 to v3.6 should be rejected if term is not set`,
version: version.V3_5,
Expand Down
10 changes: 5 additions & 5 deletions tests/e2e/logging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestNoErrorLogsDuringNormalOperations(t *testing.T) {
"setting up serving from embedded etcd failed.": true,
// See https://github.com/etcd-io/etcd/pull/19040#issuecomment-2539173800
// TODO: Remove with etcd 3.7
"cannot detect storage schema version: missing confstate information": true,
"cannot detect storage schema version: missing term information": true,
},
},
{
Expand All @@ -53,7 +53,7 @@ func TestNoErrorLogsDuringNormalOperations(t *testing.T) {
"setting up serving from embedded etcd failed.": true,
// See https://github.com/etcd-io/etcd/pull/19040#issuecomment-2539173800
// TODO: Remove with etcd 3.7
"cannot detect storage schema version: missing confstate information": true,
"cannot detect storage schema version: missing term information": true,
},
},
{
Expand All @@ -70,7 +70,7 @@ func TestNoErrorLogsDuringNormalOperations(t *testing.T) {
"setting up serving from embedded etcd failed.": true,
// See https://github.com/etcd-io/etcd/pull/19040#issuecomment-2539173800
// TODO: Remove with etcd 3.7
"cannot detect storage schema version: missing confstate information": true,
"cannot detect storage schema version: missing term information": true,
},
},
{
Expand All @@ -85,7 +85,7 @@ func TestNoErrorLogsDuringNormalOperations(t *testing.T) {
"setting up serving from embedded etcd failed.": true,
// See https://github.com/etcd-io/etcd/pull/19040#issuecomment-2539173800
// TODO: Remove with etcd 3.7
"cannot detect storage schema version: missing confstate information": true,
"cannot detect storage schema version: missing term information": true,
},
},
{
Expand All @@ -100,7 +100,7 @@ func TestNoErrorLogsDuringNormalOperations(t *testing.T) {
"setting up serving from embedded etcd failed.": true,
// See https://github.com/etcd-io/etcd/pull/19040#issuecomment-2539173800
// TODO: Remove with etcd 3.7
"cannot detect storage schema version: missing confstate information": true,
"cannot detect storage schema version: missing term information": true,
},
},
}
Expand Down