raftexample: New joined node have to start with RestartNode

This commit is contained in:
Shintaro Murakami 2021-02-17 16:18:16 +09:00
parent 8d1a8ce044
commit 1b1be43d65

View File

@ -298,14 +298,10 @@ func (rc *raftNode) startRaft() {
MaxUncommittedEntriesSize: 1 << 30, MaxUncommittedEntriesSize: 1 << 30,
} }
if oldwal { if oldwal || rc.join {
rc.node = raft.RestartNode(c) rc.node = raft.RestartNode(c)
} else { } else {
startPeers := rpeers rc.node = raft.StartNode(c, rpeers)
if rc.join {
startPeers = nil
}
rc.node = raft.StartNode(c, startPeers)
} }
rc.transport = &rafthttp.Transport{ rc.transport = &rafthttp.Transport{