raftsnap: clarify "ErrNoDBSnapshot"

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
Gyuho Lee
2018-05-02 14:17:00 -07:00
parent cc44c08d94
commit e2af59e4d1

View File

@@ -76,9 +76,18 @@ func (s *Snapshotter) DBFilePath(id uint64) (string, error) {
if _, err := fileutil.ReadDir(s.dir); err != nil {
return "", err
}
if fn := s.dbFilePath(id); fileutil.Exist(fn) {
fn := s.dbFilePath(id)
if fileutil.Exist(fn) {
return fn, nil
}
if s.lg != nil {
s.lg.Warn(
"failed to find [SNAPSHOT-INDEX].snap.db",
zap.Uint64("snapshot-index", id),
zap.String("snapshot-file-path", fn),
zap.Error(ErrNoDBSnapshot),
)
}
return "", ErrNoDBSnapshot
}