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
s3: avoid looping if the directory is empty
Chris Lu8e48a235e2e0
diff --git a/weed/s3api/s3api_objects_list_handlers.go b/weed/s3api/s3api_objects_list_handlers.goindex 5c3b898aa2..c1c6e2f891 100644--- a/weed/s3api/s3api_objects_list_handlers.go+++ b/weed/s3api/s3api_objects_list_handlers.go@@ -317,8 +317,10 @@ func (s3a *S3ApiServer) isDirectoryAllEmpty(filerClient filer_pb.SeaweedFilerClicurrentDir := parentDir + "/" + namevar startFrom stringvar isExhausted bool+ var foundEntry boolfor fileCounter == 0 && !isExhausted && err == nil {err = filer_pb.SeaweedList(filerClient, currentDir, "", func(entry *filer_pb.Entry, isLast bool) error {+ foundEntry = trueif entry.IsDirectory {subDirs = append(subDirs, entry.Name)} else {@@ -329,6 +331,9 @@ func (s3a *S3ApiServer) isDirectoryAllEmpty(filerClient filer_pb.SeaweedFilerCliglog.V(4).Infof(" * %s/%s isLast: %t", currentDir, startFrom, isLast)return nil}, startFrom, false, 8)+ if !foundEntry {+ break+ }}if err != nil {