diff --git a/server/storage/schema/schema.go b/server/storage/schema/schema.go index b87b73cc831..00a441a3fc0 100644 --- a/server/storage/schema/schema.go +++ b/server/storage/schema/schema.go @@ -73,7 +73,10 @@ func UnsafeMigrate(lg *zap.Logger, tx backend.UnsafeReadWriter, w WALVersion, ta if target.LessThan(current) { minVersion := w.MinimalEtcdVersion() if minVersion != nil && target.LessThan(*minVersion) { - return fmt.Errorf("cannot downgrade storage, WAL contains newer entries") + // Occasionally we may see this error during downgrade test due to ClusterVersionSet, + // which is harmless. Please read https://github.com/etcd-io/etcd/pull/13405#discussion_r1890378185. + return fmt.Errorf("cannot downgrade storage, WAL contains newer entries, as the target version (%s) is lower than the version (%s) detected from WAL logs", + target.String(), minVersion.String()) } } return plan.unsafeExecute(lg, tx) diff --git a/server/storage/schema/schema_test.go b/server/storage/schema/schema_test.go index 3d9bd1065c3..e87f0ff5b14 100644 --- a/server/storage/schema/schema_test.go +++ b/server/storage/schema/schema_test.go @@ -15,6 +15,7 @@ package schema import ( + "strings" "testing" "time" @@ -218,7 +219,7 @@ func TestMigrate(t *testing.T) { if (err != nil) != tc.expectError { t.Errorf("Migrate(lg, tx, %q) = %+v, expected error: %v", tc.targetVersion, err, tc.expectError) } - if err != nil && err.Error() != tc.expectErrorMsg { + if err != nil && !strings.Contains(err.Error(), tc.expectErrorMsg) { t.Errorf("Migrate(lg, tx, %q) = %q, expected error message: %q", tc.targetVersion, err, tc.expectErrorMsg) } v := UnsafeReadStorageVersion(b.BatchTx())