aboutsummaryrefslogtreecommitdiff
path: root/weed/command/filer_remote_sync_dir.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-09-11 21:53:15 -0700
committerchrislu <chris.lu@gmail.com>2022-09-11 21:53:15 -0700
commitb834027c5ae072f86f6fc7edcf55c3be1929befb (patch)
treed5e5ebfd44db511148281fd6b081e5c8e727bc34 /weed/command/filer_remote_sync_dir.go
parentd8ca7d34fe3f83dc1ad174808a2356165e066a15 (diff)
downloadseaweedfs-b834027c5ae072f86f6fc7edcf55c3be1929befb.tar.xz
seaweedfs-b834027c5ae072f86f6fc7edcf55c3be1929befb.zip
refactor
Diffstat (limited to 'weed/command/filer_remote_sync_dir.go')
-rw-r--r--weed/command/filer_remote_sync_dir.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/weed/command/filer_remote_sync_dir.go b/weed/command/filer_remote_sync_dir.go
index a36145fca..5a9170582 100644
--- a/weed/command/filer_remote_sync_dir.go
+++ b/weed/command/filer_remote_sync_dir.go
@@ -113,7 +113,7 @@ func makeEventProcessor(remoteStorage *remote_pb.RemoteConf, mountedDir string,
return nil
}
if filer_pb.IsCreate(resp) {
- if strings.Contains(message.NewParentPath, "/"+s3_constants.MultipartUploadsFolder+"/") {
+ if isMultipartUploadFile(message.NewParentPath, message.NewEntry.Name) {
return nil
}
if !filer.HasData(message.NewEntry) {
@@ -165,8 +165,8 @@ func makeEventProcessor(remoteStorage *remote_pb.RemoteConf, mountedDir string,
glog.V(2).Infof("update: %+v", resp)
glog.V(0).Infof("delete %s", remote_storage.FormatLocation(oldDest))
if err := client.DeleteFile(oldDest); err != nil {
- if !strings.Contains(resp.Directory, "/"+s3_constants.MultipartUploadsFolder+"/") {
- return err
+ if isMultipartUploadFile(resp.Directory, message.OldEntry.Name) {
+ return nil
}
}
remoteEntry, writeErr := retriedWriteFile(client, filerSource, message.NewEntry, dest)
@@ -258,3 +258,9 @@ func updateLocalEntry(filerClient filer_pb.FilerClient, dir string, entry *filer
return err
})
}
+
+func isMultipartUploadFile(dir string, name string) bool {
+ return strings.HasPrefix(dir, "/buckets/") &&
+ strings.Contains(dir, "/"+s3_constants.MultipartUploadsFolder+"/") &&
+ strings.HasSuffix(name, ".part")
+}