Browse Source

raftsnap: clarify "ErrNoDBSnapshot"

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
Gyuho Lee 7 years ago
parent
commit
e2af59e4d1
1 changed files with 10 additions and 1 deletions
  1. 10 1
      raftsnap/db.go

+ 10 - 1
raftsnap/db.go

@@ -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
 }