Browse Source

wal: filter file names in WAL directory by ".wal"

WAL never writes nor needs files without ".wal" suffix.
Thus, safe to filter out only ".wal" files.

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
Gyuho Lee 7 years ago
parent
commit
567b47fc3e
1 changed files with 1 additions and 1 deletions
  1. 1 1
      wal/util.go

+ 1 - 1
wal/util.go

@@ -28,7 +28,7 @@ var errBadWALName = errors.New("bad wal name")
 
 // Exist returns true if there are any files in a given directory.
 func Exist(dir string) bool {
-	names, err := fileutil.ReadDir(dir)
+	names, err := fileutil.ReadDir(dir, fileutil.WithExt(".wal"))
 	if err != nil {
 		return false
 	}