filer: support active<=>active filer replication

This commit is contained in:
Chris Lu
2020-06-30 22:53:53 -07:00
parent 7be57a1504
commit 31e23e9783
21 changed files with 369 additions and 313 deletions

View File

@@ -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.

View File

@@ -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 {