From 8345727ece579b7664e502422c20accaf1da7194 Mon Sep 17 00:00:00 2001 From: Marek Siarkowicz Date: Tue, 26 Sep 2023 20:22:31 +0200 Subject: [PATCH] Fix RaftCluster boostrap being based on v3 store while apply is based on v2 store. Migration off v2 store was unfinished during v3.5 development https://github.com/etcd-io/etcd/pull/12914 leaving RaftCluster broken, half migrated. This was found in v3.5 and fixed in https://github.com/etcd-io/etcd/pull/13348, however this is was not patched on main branch. This PR makes v3.6 RaftCluster consistent with v3.5 so we can cleanly migrate off v2 store. Signed-off-by: Marek Siarkowicz --- server/etcdserver/api/membership/cluster.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/etcdserver/api/membership/cluster.go b/server/etcdserver/api/membership/cluster.go index fe657fb8690..9f1b5589a50 100644 --- a/server/etcdserver/api/membership/cluster.go +++ b/server/etcdserver/api/membership/cluster.go @@ -260,12 +260,12 @@ func (c *RaftCluster) Recover(onSet func(*zap.Logger, *semver.Version)) { c.Lock() defer c.Unlock() - if c.be != nil { - c.version = c.be.ClusterVersionFromBackend() - c.members, c.removed = c.be.MustReadMembersFromBackend() - } else { + if c.v2store != nil { c.version = clusterVersionFromStore(c.lg, c.v2store) c.members, c.removed = membersFromStore(c.lg, c.v2store) + } else { + c.version = c.be.ClusterVersionFromBackend() + c.members, c.removed = c.be.MustReadMembersFromBackend() } c.buildMembershipMetric()