aboutsummaryrefslogtreecommitdiff
path: root/weed/command/filer_sync.go
diff options
context:
space:
mode:
authorKonstantin Lebedev <9497591+kmlebedev@users.noreply.github.com>2023-11-13 17:32:37 +0500
committerChris Lu <chrislusf@users.noreply.github.com>2023-11-13 06:23:46 -0800
commit3c5295a1a64380f49b46fca134f33d88317822a6 (patch)
tree80cd0facefbed05989d52193999a14f2a9df126a /weed/command/filer_sync.go
parent5e41ab137017394ed1181fb9adb794f80d352ee3 (diff)
downloadseaweedfs-3c5295a1a64380f49b46fca134f33d88317822a6.tar.xz
seaweedfs-3c5295a1a64380f49b46fca134f33d88317822a6.zip
filer backup add option for exclude file names that match the regexp to sync on filer
Diffstat (limited to 'weed/command/filer_sync.go')
-rw-r--r--weed/command/filer_sync.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/weed/command/filer_sync.go b/weed/command/filer_sync.go
index fcf60ae87..38d29cdc6 100644
--- a/weed/command/filer_sync.go
+++ b/weed/command/filer_sync.go
@@ -17,6 +17,7 @@ import (
"github.com/seaweedfs/seaweedfs/weed/util/grace"
"google.golang.org/grpc"
"os"
+ "regexp"
"strings"
"time"
)
@@ -250,7 +251,7 @@ func doSubscribeFilerMetaChanges(clientId int32, clientEpoch int32, grpcDialOpti
filerSink.DoInitialize(targetFiler.ToHttpAddress(), targetFiler.ToGrpcAddress(), targetPath, replicationStr, collection, ttlSec, diskType, grpcDialOption, sinkWriteChunkByFiler)
filerSink.SetSourceFiler(filerSource)
- persistEventFn := genProcessFunction(sourcePath, targetPath, sourceExcludePaths, filerSink, debug)
+ persistEventFn := genProcessFunction(sourcePath, targetPath, sourceExcludePaths, nil, filerSink, debug)
processEventFn := func(resp *filer_pb.SubscribeMetadataResponse) error {
message := resp.EventNotification
@@ -368,7 +369,7 @@ func setOffset(grpcDialOption grpc.DialOption, filer pb.ServerAddress, signature
}
-func genProcessFunction(sourcePath string, targetPath string, excludePaths []string, dataSink sink.ReplicationSink, debug bool) func(resp *filer_pb.SubscribeMetadataResponse) error {
+func genProcessFunction(sourcePath string, targetPath string, excludePaths []string, reExcludeFileName *regexp.Regexp, dataSink sink.ReplicationSink, debug bool) func(resp *filer_pb.SubscribeMetadataResponse) error {
// process function
processEventFn := func(resp *filer_pb.SubscribeMetadataResponse) error {
message := resp.EventNotification
@@ -393,6 +394,9 @@ func genProcessFunction(sourcePath string, targetPath string, excludePaths []str
return nil
}
}
+ if reExcludeFileName != nil && reExcludeFileName.MatchString(message.NewEntry.Name) {
+ return nil
+ }
// handle deletions
if filer_pb.IsDelete(resp) {
if !strings.HasPrefix(string(sourceOldKey), sourcePath) {