mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
always clear previous log to avoid server is promotable
https://github.com/chrislusf/seaweedfs/issues/2804
This commit is contained in:
parent
e48764be75
commit
c1450bf9fe
|
@ -81,10 +81,11 @@ func NewRaftServer(option *RaftServerOption) (*RaftServer, error) {
|
||||||
transporter := raft.NewGrpcTransporter(option.GrpcDialOption)
|
transporter := raft.NewGrpcTransporter(option.GrpcDialOption)
|
||||||
glog.V(0).Infof("Starting RaftServer with %v", option.ServerAddr)
|
glog.V(0).Infof("Starting RaftServer with %v", option.ServerAddr)
|
||||||
|
|
||||||
|
// always clear previous log to avoid server is promotable
|
||||||
|
os.RemoveAll(path.Join(s.dataDir, "log"))
|
||||||
if !option.RaftResumeState {
|
if !option.RaftResumeState {
|
||||||
// always clear previous metadata
|
// always clear previous metadata
|
||||||
os.RemoveAll(path.Join(s.dataDir, "conf"))
|
os.RemoveAll(path.Join(s.dataDir, "conf"))
|
||||||
os.RemoveAll(path.Join(s.dataDir, "log"))
|
|
||||||
os.RemoveAll(path.Join(s.dataDir, "snapshot"))
|
os.RemoveAll(path.Join(s.dataDir, "snapshot"))
|
||||||
}
|
}
|
||||||
if err := os.MkdirAll(path.Join(s.dataDir, "snapshot"), 0600); err != nil {
|
if err := os.MkdirAll(path.Join(s.dataDir, "snapshot"), 0600); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue