From be166b434f002dba684e8e3630a1e87fdb6a96db Mon Sep 17 00:00:00 2001 From: XIAOYQ Date: Thu, 18 Jan 2024 22:13:46 +0800 Subject: [PATCH 1/2] fix: skip s3 .uploads --- weed/command/filer_sync.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/weed/command/filer_sync.go b/weed/command/filer_sync.go index 20464fa50..d84c6325c 100644 --- a/weed/command/filer_sync.go +++ b/weed/command/filer_sync.go @@ -11,6 +11,7 @@ import ( "github.com/seaweedfs/seaweedfs/weed/replication/sink" "github.com/seaweedfs/seaweedfs/weed/replication/sink/filersink" "github.com/seaweedfs/seaweedfs/weed/replication/source" + "github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants" "github.com/seaweedfs/seaweedfs/weed/security" statsCollect "github.com/seaweedfs/seaweedfs/weed/stats" "github.com/seaweedfs/seaweedfs/weed/util" @@ -393,7 +394,9 @@ func genProcessFunction(sourcePath string, targetPath string, excludePaths []str if debug { glog.V(0).Infof("received %v", resp) } - + if strings.Contains(resp.Directory, "/"+s3_constants.MultipartUploadsFolder+"/") { + return nil + } if !strings.HasPrefix(resp.Directory, sourcePath) { return nil } From 15b66a6633149a2e99ef5d53cd788bdfd143e8b7 Mon Sep 17 00:00:00 2001 From: chrislu Date: Thu, 18 Jan 2024 09:13:14 -0800 Subject: [PATCH 2/2] refactor --- weed/command/filer_remote_sync_dir.go | 9 ++++++--- weed/command/filer_sync.go | 4 +++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/weed/command/filer_remote_sync_dir.go b/weed/command/filer_remote_sync_dir.go index 00f6d7493..dd3e94be6 100644 --- a/weed/command/filer_remote_sync_dir.go +++ b/weed/command/filer_remote_sync_dir.go @@ -278,7 +278,10 @@ func updateLocalEntry(filerClient filer_pb.FilerClient, dir string, entry *filer } func isMultipartUploadFile(dir string, name string) bool { - return strings.HasPrefix(dir, "/buckets/") && - strings.Contains(dir, "/"+s3_constants.MultipartUploadsFolder+"/") && - strings.HasSuffix(name, ".part") + return isMultipartUploadDir(dir) && strings.HasSuffix(name, ".part") +} + +func isMultipartUploadDir(dir string) bool { + return strings.HasPrefix(dir, "/buckets/") && + strings.Contains(dir, "/"+s3_constants.MultipartUploadsFolder+"/") } diff --git a/weed/command/filer_sync.go b/weed/command/filer_sync.go index d84c6325c..dc954e805 100644 --- a/weed/command/filer_sync.go +++ b/weed/command/filer_sync.go @@ -394,9 +394,11 @@ func genProcessFunction(sourcePath string, targetPath string, excludePaths []str if debug { glog.V(0).Infof("received %v", resp) } - if strings.Contains(resp.Directory, "/"+s3_constants.MultipartUploadsFolder+"/") { + + if isMultipartUploadDir(resp.Directory) { return nil } + if !strings.HasPrefix(resp.Directory, sourcePath) { return nil }