From c1c8dad67716666dcfd118a3ed2a95dc74227c10 Mon Sep 17 00:00:00 2001 From: Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> Date: Tue, 21 Jun 2022 13:47:51 +0500 Subject: [PATCH] avoid no such raft date directory https://github.com/chrislusf/seaweedfs/issues/3214 --- weed/server/raft_hashicorp.go | 5 ++++- weed/server/raft_server.go | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/weed/server/raft_hashicorp.go b/weed/server/raft_hashicorp.go index cc6578bf5..9971eaa48 100644 --- a/weed/server/raft_hashicorp.go +++ b/weed/server/raft_hashicorp.go @@ -121,7 +121,10 @@ func NewHashicorpRaftServer(option *RaftServerOption) (*RaftServer, error) { if option.RaftBootstrap { os.RemoveAll(path.Join(s.dataDir, ldbFile)) os.RemoveAll(path.Join(s.dataDir, sdbFile)) - os.RemoveAll(path.Join(s.dataDir, "snapshot")) + os.RemoveAll(path.Join(s.dataDir, "snapshots")) + } + if err := os.MkdirAll(path.Join(s.dataDir, "snapshots"), os.ModePerm); err != nil { + return nil, err } baseDir := s.dataDir diff --git a/weed/server/raft_server.go b/weed/server/raft_server.go index 8c372f0cc..ad0a1c8ce 100644 --- a/weed/server/raft_server.go +++ b/weed/server/raft_server.go @@ -125,7 +125,7 @@ func NewRaftServer(option *RaftServerOption) (*RaftServer, error) { os.RemoveAll(path.Join(s.dataDir, "conf")) os.RemoveAll(path.Join(s.dataDir, "snapshot")) } - if err := os.MkdirAll(path.Join(s.dataDir, "snapshot"), 0700); err != nil { + if err := os.MkdirAll(path.Join(s.dataDir, "snapshot"), os.ModePerm); err != nil { return nil, err }