aboutsummaryrefslogtreecommitdiff
path: root/weed/replication
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-06-30 22:53:53 -0700
committerChris Lu <chris.lu@gmail.com>2020-06-30 22:53:57 -0700
commit31e23e97837ba8d6a403e0b8c2d9ea6ff0bc0387 (patch)
tree73e7e3cfd697c97545c60caec10600d739d99b4f /weed/replication
parent7be57a1504890ac4a45288c5d6c8c512728d0e4d (diff)
downloadseaweedfs-31e23e97837ba8d6a403e0b8c2d9ea6ff0bc0387.tar.xz
seaweedfs-31e23e97837ba8d6a403e0b8c2d9ea6ff0bc0387.zip
filer: support active<=>active filer replication
Diffstat (limited to 'weed/replication')
-rw-r--r--weed/replication/sink/filersink/README.txt12
-rw-r--r--weed/replication/sink/filersink/filer_sink.go8
2 files changed, 17 insertions, 3 deletions
diff --git a/weed/replication/sink/filersink/README.txt b/weed/replication/sink/filersink/README.txt
new file mode 100644
index 000000000..4ba0fc752
--- /dev/null
+++ b/weed/replication/sink/filersink/README.txt
@@ -0,0 +1,12 @@
+How replication works
+======
+
+All metadata changes within current cluster would be notified to a message queue.
+
+If the meta data change is from other clusters, this metadata would change would not be notified to the message queue.
+
+So active<=>active replication is possible.
+
+
+All metadata changes would be published as metadata changes.
+So all mounts listening for metadata changes will get updated. \ No newline at end of file
diff --git a/weed/replication/sink/filersink/filer_sink.go b/weed/replication/sink/filersink/filer_sink.go
index fa9cc0f05..50721a8f3 100644
--- a/weed/replication/sink/filersink/filer_sink.go
+++ b/weed/replication/sink/filersink/filer_sink.go
@@ -69,7 +69,7 @@ func (fs *FilerSink) DeleteEntry(key string, isDirectory, deleteIncludeChunks bo
dir, name := util.FullPath(key).DirAndName()
glog.V(1).Infof("delete entry: %v", key)
- err := filer_pb.Remove(fs, dir, name, deleteIncludeChunks, false, false)
+ err := filer_pb.Remove(fs, dir, name, deleteIncludeChunks, false, false, true)
if err != nil {
glog.V(0).Infof("delete entry %s: %v", key, err)
return fmt.Errorf("delete entry %s: %v", key, err)
@@ -113,6 +113,7 @@ func (fs *FilerSink) CreateEntry(key string, entry *filer_pb.Entry) error {
Attributes: entry.Attributes,
Chunks: replicatedChunks,
},
+ IsFromOtherCluster: true,
}
glog.V(1).Infof("create: %v", request)
@@ -186,8 +187,9 @@ func (fs *FilerSink) UpdateEntry(key string, oldEntry *filer_pb.Entry, newParent
return true, fs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
request := &filer_pb.UpdateEntryRequest{
- Directory: newParentPath,
- Entry: existingEntry,
+ Directory: newParentPath,
+ Entry: existingEntry,
+ IsFromOtherCluster: true,
}
if _, err := client.UpdateEntry(context.Background(), request); err != nil {