diff options
Diffstat (limited to 'weed/command')
| -rw-r--r-- | weed/command/filer_replication.go | 13 |
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 { |
