From a6132d459f0eb41b9e342c50d65188d6940686d5 Mon Sep 17 00:00:00 2001 From: Yicheng Qin Date: Mon, 28 Jul 2014 15:58:28 -0700 Subject: [PATCH] server: save correct nodeId for participant --- etcd/participant.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/etcd/participant.go b/etcd/participant.go index 61e9395a5..3ecc91450 100644 --- a/etcd/participant.go +++ b/etcd/participant.go @@ -113,14 +113,16 @@ func newParticipant(id int64, pubAddr string, raftPubAddr string, dir string, cl if !os.IsNotExist(err) { return nil, err } + + p.id = id + p.pubAddr = pubAddr + p.raftPubAddr = raftPubAddr if w, err = wal.New(walPath); err != nil { return nil, err } w.SaveInfo(p.id) - p.id = id - p.pubAddr = pubAddr - p.raftPubAddr = raftPubAddr p.node.Node = raft.New(p.id, defaultHeartbeat, defaultElection) + log.Printf("id=%x participant.new path=%s\n", p.id, walPath) } else { n, err := w.LoadNode() if err != nil { @@ -128,6 +130,7 @@ func newParticipant(id int64, pubAddr string, raftPubAddr string, dir string, cl } p.id = n.Id p.node.Node = raft.Recover(n.Id, n.Ents, n.State, defaultHeartbeat, defaultElection) + log.Printf("id=%x participant.load path=%s\n", p.id, walPath) } p.w = w