mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #31 from xiangli-cmu/master
do not try the empty machine name
This commit is contained in:
commit
d0ec1007a2
14
etcd.go
14
etcd.go
@ -225,6 +225,9 @@ func startRaft(securityType int) {
|
|||||||
raftServer.SetElectionTimeout(ELECTIONTIMTOUT)
|
raftServer.SetElectionTimeout(ELECTIONTIMTOUT)
|
||||||
raftServer.SetHeartbeatTimeout(HEARTBEATTIMEOUT)
|
raftServer.SetHeartbeatTimeout(HEARTBEATTIMEOUT)
|
||||||
|
|
||||||
|
// start to response to raft requests
|
||||||
|
go startRaftTransport(info.RaftPort, securityType)
|
||||||
|
|
||||||
if raftServer.IsLogEmpty() {
|
if raftServer.IsLogEmpty() {
|
||||||
|
|
||||||
// start as a leader in a new cluster
|
// start as a leader in a new cluster
|
||||||
@ -249,10 +252,12 @@ func startRaft(securityType int) {
|
|||||||
|
|
||||||
// start as a follower in a existing cluster
|
// start as a follower in a existing cluster
|
||||||
} else {
|
} else {
|
||||||
raftServer.StartFollower()
|
raftServer.StartFollower(false)
|
||||||
|
|
||||||
for _, machine := range cluster {
|
for _, machine := range cluster {
|
||||||
|
if len(machine) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
err = joinCluster(raftServer, machine)
|
err = joinCluster(raftServer, machine)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
debug("cannot join to cluster via machine %s %s", machine, err)
|
debug("cannot join to cluster via machine %s %s", machine, err)
|
||||||
@ -268,7 +273,7 @@ func startRaft(securityType int) {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
// rejoin the previous cluster
|
// rejoin the previous cluster
|
||||||
raftServer.StartFollower()
|
raftServer.StartFollower(true)
|
||||||
debug("%s restart as a follower", raftServer.Name())
|
debug("%s restart as a follower", raftServer.Name())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,9 +282,6 @@ func startRaft(securityType int) {
|
|||||||
go raftServer.Snapshot()
|
go raftServer.Snapshot()
|
||||||
}
|
}
|
||||||
|
|
||||||
// start to response to raft requests
|
|
||||||
go startRaftTransport(info.RaftPort, securityType)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create transporter using by raft server
|
// Create transporter using by raft server
|
||||||
|
Loading…
x
Reference in New Issue
Block a user