diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-04-16 00:44:31 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-04-16 00:44:31 -0700 |
| commit | b3b42bc947ec44acdc69efdeebb623a0c092078a (patch) | |
| tree | 9fecee1d6f5bced1e7e1436a331e8c8973db8a78 /weed/replication/replicator.go | |
| parent | 967e108b9a33d4e3cdd59dacd3356c070ed312a9 (diff) | |
| download | seaweedfs-b3b42bc947ec44acdc69efdeebb623a0c092078a.tar.xz seaweedfs-b3b42bc947ec44acdc69efdeebb623a0c092078a.zip | |
replicate need to include new entry path
Diffstat (limited to 'weed/replication/replicator.go')
| -rw-r--r-- | weed/replication/replicator.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/weed/replication/replicator.go b/weed/replication/replicator.go index 20c1d08b5..7353cdc91 100644 --- a/weed/replication/replicator.go +++ b/weed/replication/replicator.go @@ -2,6 +2,7 @@ package replication import ( "context" + "fmt" "path/filepath" "strings" @@ -51,12 +52,17 @@ func (r *Replicator) Replicate(ctx context.Context, key string, message *filer_p return nil } - foundExisting, err := r.sink.UpdateEntry(ctx, key, message.OldEntry, message.NewEntry, message.DeleteChunks) + foundExisting, err := r.sink.UpdateEntry(ctx, key, message.OldEntry, message.NewParentPath, message.NewEntry, message.DeleteChunks) if foundExisting { glog.V(4).Infof("updated %v", key) return err } + err = r.sink.DeleteEntry(ctx, key, message.OldEntry.IsDirectory, false) + if err != nil { + return fmt.Errorf("delete old entry %v: %v", key, err) + } + glog.V(4).Infof("creating missing %v", key) return r.sink.CreateEntry(ctx, key, message.NewEntry) } |
