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.

passing ctx for metadata logging

Chris Ludf75b5c98d5f
diff --git a/weed/filer2/filer.go b/weed/filer2/filer.go
index 666ab8fe4d..1e8a8b5406 100644
--- a/weed/filer2/filer.go
+++ b/weed/filer2/filer.go
@@ -141,7 +141,7 @@ func (f *Filer) CreateEntry(ctx context.Context, entry *Entry, o_excl bool) erro
}
} else {
f.maybeAddBucket(dirEntry)
- f.NotifyUpdateEvent(nil, dirEntry, false)
+ f.NotifyUpdateEvent(ctx, nil, dirEntry, false)
}
} else if !dirEntry.IsDirectory() {
@@ -192,7 +192,7 @@ func (f *Filer) CreateEntry(ctx context.Context, entry *Entry, o_excl bool) erro
}
f.maybeAddBucket(entry)
- f.NotifyUpdateEvent(oldEntry, entry, true)
+ f.NotifyUpdateEvent(ctx, oldEntry, entry, true)
f.deleteChunksIfNotNew(oldEntry, entry)
diff --git a/weed/filer2/filer_delete_entry.go b/weed/filer2/filer_delete_entry.go
index 2fb53c579d..7f698a7a13 100644
--- a/weed/filer2/filer_delete_entry.go
+++ b/weed/filer2/filer_delete_entry.go
@@ -74,7 +74,7 @@ func (f *Filer) doBatchDeleteFolderMetaAndData(ctx context.Context, entry *Entry
if sub.IsDirectory() {
dirChunks, err = f.doBatchDeleteFolderMetaAndData(ctx, sub, isRecursive, ignoreRecursiveError, shouldDeleteChunks)
f.cacheDelDirectory(string(sub.FullPath))
- f.NotifyUpdateEvent(sub, nil, shouldDeleteChunks)
+ f.NotifyUpdateEvent(ctx, sub, nil, shouldDeleteChunks)
chunks = append(chunks, dirChunks...)
} else {
chunks = append(chunks, sub.Chunks...)
@@ -108,7 +108,7 @@ func (f *Filer) doDeleteEntryMetaAndData(ctx context.Context, entry *Entry, shou
if entry.IsDirectory() {
f.cacheDelDirectory(string(entry.FullPath))
}
- f.NotifyUpdateEvent(entry, nil, shouldDeleteChunks)
+ f.NotifyUpdateEvent(ctx, entry, nil, shouldDeleteChunks)
return nil
}
diff --git a/weed/filer2/filer_notify.go b/weed/filer2/filer_notify.go
index ecb488373e..d63e9609c9 100644
--- a/weed/filer2/filer_notify.go
+++ b/weed/filer2/filer_notify.go
@@ -15,7 +15,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/util"
)
-func (f *Filer) NotifyUpdateEvent(oldEntry, newEntry *Entry, deleteChunks bool) {
+func (f *Filer) NotifyUpdateEvent(ctx context.Context, oldEntry, newEntry *Entry, deleteChunks bool) {
var fullpath string
if oldEntry != nil {
fullpath = string(oldEntry.FullPath)
@@ -47,11 +47,11 @@ func (f *Filer) NotifyUpdateEvent(oldEntry, newEntry *Entry, deleteChunks bool)
notification.Queue.SendMessage(fullpath, eventNotification)
}
- f.logMetaEvent(fullpath, eventNotification)
+ f.logMetaEvent(ctx, fullpath, eventNotification)
}
-func (f *Filer) logMetaEvent(fullpath string, eventNotification *filer_pb.EventNotification) {
+func (f *Filer) logMetaEvent(ctx context.Context, fullpath string, eventNotification *filer_pb.EventNotification) {
dir, _ := util.FullPath(fullpath).DirAndName()
diff --git a/weed/server/filer_grpc_server.go b/weed/server/filer_grpc_server.go
index 901f798f06..59be0686d2 100644
--- a/weed/server/filer_grpc_server.go
+++ b/weed/server/filer_grpc_server.go
@@ -220,7 +220,7 @@ func (fs *FilerServer) UpdateEntry(ctx context.Context, req *filer_pb.UpdateEntr
glog.V(3).Infof("UpdateEntry %s: %v", filepath.Join(req.Directory, req.Entry.Name), err)
}
- fs.filer.NotifyUpdateEvent(entry, newEntry, true)
+ fs.filer.NotifyUpdateEvent(ctx, entry, newEntry, true)
return &filer_pb.UpdateEntryResponse{}, err
}