From 551c2a3377018af9c77c901978c7620256e83a44 Mon Sep 17 00:00:00 2001 From: nolouch Date: Wed, 25 Dec 2019 20:06:46 +0800 Subject: [PATCH] revert changes Signed-off-by: nolouch --- pkg/etcdutil/etcdutil.go | 4 ++-- pkg/etcdutil/etcdutil_test.go | 2 +- server/leader.go | 2 +- server/server.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/etcdutil/etcdutil.go b/pkg/etcdutil/etcdutil.go index c7d7e5849e1..5be0255bb64 100644 --- a/pkg/etcdutil/etcdutil.go +++ b/pkg/etcdutil/etcdutil.go @@ -42,7 +42,7 @@ const ( // CheckClusterID checks Etcd's cluster ID, returns an error if mismatch. // This function will never block even quorum is not satisfied. -func CheckClusterID(localClusterID uint64, um types.URLsMap, tlsConfig *tls.Config) error { +func CheckClusterID(localClusterID types.ID, um types.URLsMap, tlsConfig *tls.Config) error { if len(um) == 0 { return nil } @@ -65,7 +65,7 @@ func CheckClusterID(localClusterID uint64, um types.URLsMap, tlsConfig *tls.Conf } remoteClusterID := remoteCluster.ID() - if uint64(remoteClusterID) != localClusterID { + if remoteClusterID != localClusterID { return errors.Errorf("Etcd cluster ID mismatch, expect %d, got %d", localClusterID, remoteClusterID) } } diff --git a/pkg/etcdutil/etcdutil_test.go b/pkg/etcdutil/etcdutil_test.go index 21632783a0d..a041b7fc9b9 100644 --- a/pkg/etcdutil/etcdutil_test.go +++ b/pkg/etcdutil/etcdutil_test.go @@ -123,7 +123,7 @@ func (s *testEtcdutilSuite) TestMemberHelpers(c *C) { // Test CheckClusterID urlmap, err := types.NewURLsMap(cfg2.InitialCluster) c.Assert(err, IsNil) - err = CheckClusterID(uint64(etcd1.Server.Cluster().ID()), urlmap, &tls.Config{}) + err = CheckClusterID(etcd1.Server.Cluster().ID(), urlmap, &tls.Config{}) c.Assert(err, IsNil) // Test RemoveEtcdMember diff --git a/server/leader.go b/server/leader.go index 3fa0506d752..fcb70a24d7f 100644 --- a/server/leader.go +++ b/server/leader.go @@ -338,7 +338,7 @@ func (s *Server) watchLeader(leader *pdpb.Member, revision int64) { } for _, ev := range wresp.Events { - if int32(ev.Type) == int32(mvccpb.DELETE) { + if ev.Type == mvccpb.DELETE { log.Info("leader is deleted") return } diff --git a/server/server.go b/server/server.go index 8139f1f5da4..4219627c73d 100644 --- a/server/server.go +++ b/server/server.go @@ -158,7 +158,7 @@ func (s *Server) startEtcd(ctx context.Context) error { if err != nil { return err } - if err = etcdutil.CheckClusterID(uint64(etcd.Server.Cluster().ID()), urlmap, tlsConfig); err != nil { + if err = etcdutil.CheckClusterID(etcd.Server.Cluster().ID(), urlmap, tlsConfig); err != nil { return err }