aboutsummaryrefslogtreecommitdiff
path: root/weed/command/filer_replication.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-01-26 11:08:44 -0800
committerChris Lu <chris.lu@gmail.com>2021-01-26 11:08:44 -0800
commitad2a20c8a5827461d07ab2a46932d0c1c89d1b37 (patch)
tree951b46f31eb1d3fb2107efe062db99a1e99c10d1 /weed/command/filer_replication.go
parent3a1d3d3413c5fc6a49c138ed5024f2b907f63d37 (diff)
downloadseaweedfs-ad2a20c8a5827461d07ab2a46932d0c1c89d1b37.tar.xz
seaweedfs-ad2a20c8a5827461d07ab2a46932d0c1c89d1b37.zip
notification add ack and nack
Diffstat (limited to 'weed/command/filer_replication.go')
-rw-r--r--weed/command/filer_replication.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/weed/command/filer_replication.go b/weed/command/filer_replication.go
index 4f698e375..0b6eaf94e 100644
--- a/weed/command/filer_replication.go
+++ b/weed/command/filer_replication.go
@@ -97,13 +97,19 @@ func runFilerReplicate(cmd *Command, args []string) bool {
replicator := replication.NewReplicator(config, "source.filer.", dataSink)
for {
- key, m, err := notificationInput.ReceiveMessage()
+ key, m, onSuccessFn, onFailureFn, err := notificationInput.ReceiveMessage()
if err != nil {
glog.Errorf("receive %s: %+v", key, err)
+ if onFailureFn != nil {
+ onFailureFn()
+ }
continue
}
if key == "" {
// long poll received no messages
+ if onSuccessFn != nil {
+ onSuccessFn()
+ }
continue
}
if m.OldEntry != nil && m.NewEntry == nil {
@@ -115,8 +121,14 @@ func runFilerReplicate(cmd *Command, args []string) bool {
}
if err = replicator.Replicate(context.Background(), key, m); err != nil {
glog.Errorf("replicate %s: %+v", key, err)
+ if onFailureFn != nil {
+ onFailureFn()
+ }
} else {
glog.V(1).Infof("replicated %s", key)
+ if onSuccessFn != nil {
+ onSuccessFn()
+ }
}
}