Closed xiang90 closed 10 years ago
/cc @benbjohnson https://drone.io/github.com/xiangli-cmu/raft/24
Introduced a bug in last pr :(
dang, lgtm.
@xiangli-cmu What happens if the directory exists but it's not writable? I don't quite understand why we're only checking for one type of error with Mkdir()
.
we are checking for all types except previous existence. pervious existence is not an error we should report.
@xiangli-cmu How is err != nil && os.IsNotExist(err)
checking for all types except for existence? That should only be true where err == ErrNotExist
. Basically, only when the directory doesn't exist.
Did you mean err != nil && !os.IsNotExist(err)
?
@benbjohnson
IsNotExist returns a boolean indicating whether the error is known to report that a file or directory does not exist. It is satisfied by ErrNotExist as well as some syscall errors.
It says "It is satisfied by ErrNotExist as well as some syscall errors". Did I misunderstand this sentence?
@xiangli-cmu The only time ErrNotExists
will occur with Mkdir()
is if the parent directory doesn't exist. In this case, the parent directory is s.path
, which should exist.
hm... i misunderstood this error sorry
@xiangli-cmu https://github.com/xiangli-cmu The only time ErrNotExistswill occur with Mkdir() is if the parent directory doesn't exist. In this case, the parent directory is s.path, which should exist.
http://play.golang.org/p/Kezcz9swTX
Reply to this email directly or view it on GitHubhttps://github.com/goraft/raft/pull/203#issuecomment-38364784 .
No worries. You just need a bang for all errors besides "not exists": err != nil && !os.IsNotExist(err)
We should only report error if the snapshot path is not exist and we cannot create a new one.