Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

auto create non-existing cache directory

Chris Lubb3e86fbd5b2
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go
index 67dd2a62cc..2b0ef64c22 100644
--- a/weed/filesys/wfs.go
+++ b/weed/filesys/wfs.go
@@ -89,6 +89,7 @@ func NewSeaweedFileSystem(option *Option) *WFS {
},
}
if option.CacheSizeMB > 0 {
+ os.MkdirAll(option.CacheDir, 0755)
wfs.chunkCache = chunk_cache.NewChunkCache(256, option.CacheDir, option.CacheSizeMB)
grace.OnInterrupt(func() {
wfs.chunkCache.Shutdown()
diff --git a/weed/util/file_util.go b/weed/util/file_util.go
index bef9f7cd6a..ff725830bb 100644
--- a/weed/util/file_util.go
+++ b/weed/util/file_util.go
@@ -49,6 +49,10 @@ func CheckFile(filename string) (exists, canRead, canWrite bool, modTime time.Ti
exists = false
return
}
+ if err != nil {
+ glog.Errorf("check %s: %v", filename, err)
+ return
+ }
if fi.Mode()&0400 != 0 {
canRead = true
}