Browse Source

better fix for single master restart without peers changing

pull/608/merge
Chris Lu 7 years ago
parent
commit
70f6740309
  1. 6
      weed/server/raft_server.go

6
weed/server/raft_server.go

@ -55,7 +55,7 @@ func NewRaftServer(r *mux.Router, peers []string, httpAddr string, dataDir strin
if oldPeers, changed := isPeersChanged(s.dataDir, httpAddr, s.peers); changed {
glog.V(0).Infof("Peers Change: %v => %v", oldPeers, s.peers)
os.RemoveAll(path.Join(s.dataDir, "conf"))
// os.RemoveAll(path.Join(s.dataDir, "log"))
os.RemoveAll(path.Join(s.dataDir, "log"))
os.RemoveAll(path.Join(s.dataDir, "snapshot"))
}
@ -141,6 +141,10 @@ func isPeersChanged(dir string, self string, peers []string) (oldPeers []string,
}
oldPeers = append(oldPeers, self)
if len(peers) == 0 && len(oldPeers) <= 1 {
return oldPeers, false
}
sort.Strings(peers)
sort.Strings(oldPeers)

Loading…
Cancel
Save