From 9ef142c4afb5dcdc04318ed0153e341e097cbaef Mon Sep 17 00:00:00 2001 From: Piotr Tabor Date: Tue, 27 Apr 2021 19:34:12 +0200 Subject: [PATCH] fixup! v2 etcdctl backup: producing consistent state of membership --- server/etcdserver/api/membership/store.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/server/etcdserver/api/membership/store.go b/server/etcdserver/api/membership/store.go index 925538b6c83b..96b20cb0e699 100644 --- a/server/etcdserver/api/membership/store.go +++ b/server/etcdserver/api/membership/store.go @@ -119,24 +119,25 @@ func mustReadMembersFromBackend(lg *zap.Logger, be backend.Backend) (map[types.I // TrimMembershipFromBackend removes all information about members & // removed_members from the v3 backend. func TrimMembershipFromBackend(lg *zap.Logger, be backend.Backend) error { + lg.Info("Trimming membership information from the backend...") tx := be.BatchTx() tx.Lock() defer tx.Unlock() err := tx.UnsafeForEach(membersBucketName, func(k, v []byte) error { tx.UnsafeDelete(membersBucketName, k) + lg.Debug("Removed member from the backend", + zap.Stringer("member", mustParseMemberIDFromBytes(lg, k))) return nil }) if err != nil { return err } - err = tx.UnsafeForEach(membersRemovedBucketName, func(k, v []byte) error { + return tx.UnsafeForEach(membersRemovedBucketName, func(k, v []byte) error { tx.UnsafeDelete(membersRemovedBucketName, k) + lg.Debug("Removed removed_member from the backend", + zap.Stringer("member", mustParseMemberIDFromBytes(lg, k))) return nil }) - if err != nil { - return err - } - return nil } // TrimMembershipFromV2Store removes all information about members &