From fb75fe852c5282cef436329bb0700d4d0e09f511 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sat, 15 Mar 2014 00:36:51 -0700 Subject: [PATCH] ignore "-peers" option if cluster is already bootstrapped --- go/weed/weed_server/raft_server.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/go/weed/weed_server/raft_server.go b/go/weed/weed_server/raft_server.go index 0cc565766..14cd1461b 100644 --- a/go/weed/weed_server/raft_server.go +++ b/go/weed/weed_server/raft_server.go @@ -58,14 +58,13 @@ func NewRaftServer(r *mux.Router, version string, peers []string, httpAddr strin if !s.raftServer.IsLogEmpty() { glog.V(0).Infoln("Cannot join with an existing log") + } else { + if err := s.Join(s.peers); err != nil { + return nil + } + glog.V(0).Infoln("Joined cluster") } - if err := s.Join(s.peers); err != nil { - return nil - } - - glog.V(0).Infoln("Joined cluster") - // Initialize the server by joining itself. } else if s.raftServer.IsLogEmpty() { glog.V(0).Infoln("Initializing new cluster")