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.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
filer: demote client-cancelled directory listing log from error (#11495) (#11496)
yi1114fec65d949f4
diff --git a/weed/filer/filer.go b/weed/filer/filer.goindex 88943d4c07..d83486c869 100644--- a/weed/filer/filer.go+++ b/weed/filer/filer.go@@ -606,7 +606,7 @@ func (f *Filer) doListDirectoryEntries(ctx context.Context, p util.FullPath, stalastFileName, err = f.Store.ListDirectoryPrefixedEntries(ctx, p, startFileName, inclusive, limit, prefix, func(entry *Entry) (bool, error) {select {case <-ctx.Done():- glog.Errorf("Context is done.")+ glog.V(1).InfofCtx(ctx, "listing %q canceled: %v", p, ctx.Err())return false, fmt.Errorf("context canceled: %w", ctx.Err())default:if entry.TtlSec > 0 && !entry.IsDirectory() {diff --git a/weed/filer/filer_prefix_object_test.go b/weed/filer/filer_prefix_object_test.goindex b18b9d6ba3..42f9ba480c 100644--- a/weed/filer/filer_prefix_object_test.go+++ b/weed/filer/filer_prefix_object_test.go@@ -104,3 +104,23 @@ func TestExpiredFileIsDeletedOnRead(t *testing.T) {require.ErrorIs(t, err, filer_pb.ErrNotFound,"native TTL lookup should remove the expired metadata row")}++func TestListDirectoryEntriesContextCanceled(t *testing.T) {+ f, store := newTestFilerWithStubStore()+ ctx := context.Background()++ require.NoError(t, store.InsertEntry(ctx, &Entry{+ FullPath: util.FullPath("/dir/file1.txt"),+ Attr: Attr{Mode: 0o644},+ }))++ canceledCtx, cancel := context.WithCancel(ctx)+ cancel()++ _, _, err := f.doListDirectoryEntries(canceledCtx, util.FullPath("/dir"), "", false, 10, "", func(entry *Entry) (bool, error) {+ return true, nil+ })+ require.Error(t, err)+ assert.ErrorContains(t, err, "context canceled")+}+