Skip to content

Commit

Permalink
revert changes
Browse files Browse the repository at this point in the history
Signed-off-by: nolouch <[email protected]>
  • Loading branch information
nolouch committed Dec 25, 2019
1 parent 45445a8 commit 551c2a3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pkg/etcdutil/etcdutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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)
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/etcdutil/etcdutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion server/leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 551c2a3

Please sign in to comment.