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.

clear file.entry

Chris Lu6135cbaa0211
diff --git a/weed/filesys/file.go b/weed/filesys/file.go
index fb7b83cbeb..d2ae346542 100644
--- a/weed/filesys/file.go
+++ b/weed/filesys/file.go
@@ -301,6 +301,12 @@ func (file *File) setEntry(entry *filer_pb.Entry) {
file.reader = nil
}
+func (file *File) clearEntry() {
+ file.entry = nil
+ file.entryViewCache = nil
+ file.reader = nil
+}
+
func (file *File) saveEntry() error {
return file.wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go
index 293b09dcfc..d31579fcee 100644
--- a/weed/filesys/wfs.go
+++ b/weed/filesys/wfs.go
@@ -96,7 +96,7 @@ func NewSeaweedFileSystem(option *Option) *WFS {
fsNode := wfs.fsNodeCache.GetFsNode(filePath)
if fsNode != nil {
if file, ok := fsNode.(*File); ok {
- file.setEntry(nil)
+ file.clearEntry()
}
}
})