Commit 4ae1b85a authored by Steven Allen's avatar Steven Allen

fix: only log when we find a file we don't expect

We _expect_ temporary put- files.
parent a348e6ec
...@@ -290,7 +290,12 @@ func (fs *Datastore) encode(key datastore.Key) (dir, file string) { ...@@ -290,7 +290,12 @@ func (fs *Datastore) encode(key datastore.Key) (dir, file string) {
} }
func (fs *Datastore) decode(file string) (key datastore.Key, ok bool) { func (fs *Datastore) decode(file string) (key datastore.Key, ok bool) {
if filepath.Ext(file) != extension { if !strings.HasSuffix(file, extension) {
// We expect random files like "put-". Log when we encounter
// others.
if !strings.HasPrefix(file, "put-") {
log.Warnw("failed to decode flatfs filename", "file", file)
}
return datastore.Key{}, false return datastore.Key{}, false
} }
name := file[:len(file)-len(extension)] name := file[:len(file)-len(extension)]
...@@ -1064,7 +1069,7 @@ func (fs *Datastore) walk(path string, qrb *query.ResultBuilder) error { ...@@ -1064,7 +1069,7 @@ func (fs *Datastore) walk(path string, qrb *query.ResultBuilder) error {
key, ok := fs.decode(fn) key, ok := fs.decode(fn)
if !ok { if !ok {
log.Warnw("failed to decode flatfs entry", "file", fn) // not a block.
continue continue
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment