aboutsummaryrefslogtreecommitdiff
path: root/weed/command/filer_replication.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2018-09-23 00:40:36 -0700
committerChris Lu <chris.lu@gmail.com>2018-09-23 00:40:36 -0700
commit9fe24991d5b5be0cd3f56cbb65883c67c20fdfe6 (patch)
treebe465d1ceae0b8968986b09c13cf2ac2dcca5873 /weed/command/filer_replication.go
parent7d6b2a4740c32c3a07a4ce4204da2debee371bcd (diff)
downloadseaweedfs-9fe24991d5b5be0cd3f56cbb65883c67c20fdfe6.tar.xz
seaweedfs-9fe24991d5b5be0cd3f56cbb65883c67c20fdfe6.zip
refactoring
Diffstat (limited to 'weed/command/filer_replication.go')
-rw-r--r--weed/command/filer_replication.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/weed/command/filer_replication.go b/weed/command/filer_replication.go
index 9f8f4442a..b19597245 100644
--- a/weed/command/filer_replication.go
+++ b/weed/command/filer_replication.go
@@ -5,6 +5,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/replication"
"github.com/chrislusf/seaweedfs/weed/server"
"github.com/spf13/viper"
+ "strings"
)
func init() {
@@ -44,6 +45,18 @@ func runFilerReplicate(cmd *Command, args []string) bool {
}
}
+ // avoid recursive replication
+ if config.GetBool("notification.source.filer.enabled") && config.GetBool("notification.sink.filer.enabled") {
+ sourceConfig, sinkConfig := config.Sub("source.filer"), config.Sub("sink.filer")
+ if sourceConfig.GetString("grpcAddress") == sinkConfig.GetString("grpcAddress") {
+ fromDir := sourceConfig.GetString("directory")
+ toDir := sinkConfig.GetString("directory")
+ if strings.HasPrefix(toDir, fromDir) {
+ glog.Fatalf("recursive replication! source directory %s includes the sink directory %s", fromDir, toDir)
+ }
+ }
+ }
+
replicator := replication.NewReplicator(config.Sub("source.filer"), config.Sub("sink.filer"))
for {