aboutsummaryrefslogtreecommitdiff
path: root/weed
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-05-25 17:19:17 -0700
committerChris Lu <chris.lu@gmail.com>2021-05-25 17:19:20 -0700
commitdce1f02c9efcf78f05e7f81f3cc116e594591642 (patch)
tree393d8ffb33ade1ded77e7fea00ab3afa2150fa86 /weed
parent35ca9638c422c63383f922ace499472d1b897c77 (diff)
downloadseaweedfs-dce1f02c9efcf78f05e7f81f3cc116e594591642.tar.xz
seaweedfs-dce1f02c9efcf78f05e7f81f3cc116e594591642.zip
filer.backup: backup to local directory optionally is incremental
fixed one issue with https://github.com/chrislusf/seaweedfs/issues/2084
Diffstat (limited to 'weed')
-rw-r--r--weed/command/scaffold.go6
-rw-r--r--weed/replication/sink/localsink/local_sink.go13
-rw-r--r--weed/util/config.go3
3 files changed, 9 insertions, 13 deletions
diff --git a/weed/command/scaffold.go b/weed/command/scaffold.go
index 8dc64aa6b..806e18fbc 100644
--- a/weed/command/scaffold.go
+++ b/weed/command/scaffold.go
@@ -377,12 +377,6 @@ directory = "/data"
# so each date directory contains all new and updated files.
is_incremental = false
-[sink.local_incremental]
-# all replicated files are under modified time as yyyy-mm-dd directories
-# so each date directory contains all new and updated files.
-enabled = false
-directory = "/backup"
-
[sink.filer]
enabled = false
grpcAddress = "localhost:18888"
diff --git a/weed/replication/sink/localsink/local_sink.go b/weed/replication/sink/localsink/local_sink.go
index 2b9b3e69a..e40ad8bb6 100644
--- a/weed/replication/sink/localsink/local_sink.go
+++ b/weed/replication/sink/localsink/local_sink.go
@@ -15,8 +15,9 @@ import (
)
type LocalSink struct {
- Dir string
- filerSource *source.FilerSource
+ Dir string
+ filerSource *source.FilerSource
+ isIncremental bool
}
func init() {
@@ -35,15 +36,17 @@ func (localsink *LocalSink) isMultiPartEntry(key string) bool {
return strings.HasSuffix(key, ".part") && strings.Contains(key, "/.uploads/")
}
-func (localsink *LocalSink) initialize(dir string) error {
+func (localsink *LocalSink) initialize(dir string, isIncremental bool) error {
localsink.Dir = dir
+ localsink.isIncremental = isIncremental
return nil
}
func (localsink *LocalSink) Initialize(configuration util.Configuration, prefix string) error {
dir := configuration.GetString(prefix + "directory")
+ isIncremental := configuration.GetBool(prefix + "is_incremental")
glog.V(4).Infof("sink.local.directory: %v", dir)
- return localsink.initialize(dir)
+ return localsink.initialize(dir, isIncremental)
}
func (localsink *LocalSink) GetSinkToDirectory() string {
@@ -51,7 +54,7 @@ func (localsink *LocalSink) GetSinkToDirectory() string {
}
func (localsink *LocalSink) IsIncremental() bool {
- return true
+ return localsink.isIncremental
}
func (localsink *LocalSink) DeleteEntry(key string, isDirectory, deleteIncludeChunks bool, signatures []int32) error {
diff --git a/weed/util/config.go b/weed/util/config.go
index ee805f26a..ae9397340 100644
--- a/weed/util/config.go
+++ b/weed/util/config.go
@@ -26,8 +26,6 @@ func LoadConfiguration(configFileName string, required bool) (loaded bool) {
viper.AddConfigPath("/usr/local/etc/seaweedfs/") // search path for bsd-style config directory in
viper.AddConfigPath("/etc/seaweedfs/") // path to look for the config file in
- glog.V(1).Infof("Reading %s.toml from %s", configFileName, viper.ConfigFileUsed())
-
if err := viper.MergeInConfig(); err != nil { // Handle errors reading the config file
if strings.Contains(err.Error(), "Not Found") {
glog.V(1).Infof("Reading %s: %v", viper.ConfigFileUsed(), err)
@@ -43,6 +41,7 @@ func LoadConfiguration(configFileName string, required bool) (loaded bool) {
return false
}
}
+ glog.V(1).Infof("Reading %s.toml from %s", configFileName, viper.ConfigFileUsed())
return true
}