aboutsummaryrefslogtreecommitdiff
path: root/weed/command/filer_backup.go
diff options
context:
space:
mode:
authorKonstantin Lebedev <9497591+kmlebedev@users.noreply.github.com>2023-11-17 18:25:09 +0500
committerChris Lu <chrislusf@users.noreply.github.com>2023-11-17 07:37:28 -0800
commit2b229e98cee862b66f9aa988e53da6b1ec79d716 (patch)
treebbc5f9f4db0028193abc5f3f40f760ab81b037df /weed/command/filer_backup.go
parent17710e1ecbd36409fa5b14861c025aacf943b6fd (diff)
downloadseaweedfs-2b229e98cee862b66f9aa988e53da6b1ec79d716.tar.xz
seaweedfs-2b229e98cee862b66f9aa988e53da6b1ec79d716.zip
fix: add doDeleteFile option for filer backup
Diffstat (limited to 'weed/command/filer_backup.go')
-rw-r--r--weed/command/filer_backup.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/weed/command/filer_backup.go b/weed/command/filer_backup.go
index cd63f49f7..691b1c0b5 100644
--- a/weed/command/filer_backup.go
+++ b/weed/command/filer_backup.go
@@ -20,6 +20,7 @@ type FilerBackupOptions struct {
excludeFileName *string
debug *bool
proxyByFiler *bool
+ doDeleteFiles *bool
timeAgo *time.Duration
retentionDays *int
}
@@ -35,10 +36,10 @@ func init() {
filerBackupOptions.excludePaths = cmdFilerBackup.Flag.String("filerExcludePaths", "", "exclude directories to sync on filer")
filerBackupOptions.excludeFileName = cmdFilerBackup.Flag.String("filerExcludeFileName", "", "exclude file names that match the regexp to sync on filer")
filerBackupOptions.proxyByFiler = cmdFilerBackup.Flag.Bool("filerProxy", false, "read and write file chunks by filer instead of volume servers")
+ filerBackupOptions.doDeleteFiles = cmdFilerBackup.Flag.Bool("doDeleteFiles", false, "delete files on the destination")
filerBackupOptions.debug = cmdFilerBackup.Flag.Bool("debug", false, "debug mode to print out received files")
filerBackupOptions.timeAgo = cmdFilerBackup.Flag.Duration("timeAgo", 0, "start time before now. \"300ms\", \"1.5h\" or \"2h45m\". Valid time units are \"ns\", \"us\" (or \"µs\"), \"ms\", \"s\", \"m\", \"h\"")
filerBackupOptions.retentionDays = cmdFilerBackup.Flag.Int("retentionDays", 0, "incremental backup retention days")
-
}
var cmdFilerBackup = &Command{
@@ -129,7 +130,7 @@ func doFilerBackup(grpcDialOption grpc.DialOption, backupOption *FilerBackupOpti
*backupOption.proxyByFiler)
dataSink.SetSourceFiler(filerSource)
- processEventFn := genProcessFunction(sourcePath, targetPath, excludePaths, reExcludeFileName, dataSink, debug)
+ processEventFn := genProcessFunction(sourcePath, targetPath, excludePaths, reExcludeFileName, dataSink, *backupOption.doDeleteFiles, debug)
processEventFnWithOffset := pb.AddOffsetFunc(processEventFn, 3*time.Second, func(counter int64, lastTsNs int64) error {
glog.V(0).Infof("backup %s progressed to %v %0.2f/sec", sourceFiler, time.Unix(0, lastTsNs), float64(counter)/float64(3))