diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-02-25 11:13:06 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-02-25 11:13:06 -0800 |
| commit | 7d10fdf73720fb3234cd5cacfaf10fb79590d754 (patch) | |
| tree | 3c8d1170824d605bdb6532cf657b85824fd848dd /weed/replication | |
| parent | e86da5a4918e0cf663a8c592387c72c850647e4e (diff) | |
| download | seaweedfs-7d10fdf73720fb3234cd5cacfaf10fb79590d754.tar.xz seaweedfs-7d10fdf73720fb3234cd5cacfaf10fb79590d754.zip | |
fix directory lookup nil
Diffstat (limited to 'weed/replication')
| -rw-r--r-- | weed/replication/sink/filersink/filer_sink.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/weed/replication/sink/filersink/filer_sink.go b/weed/replication/sink/filersink/filer_sink.go index 8c4c39bc4..cdc4f4a45 100644 --- a/weed/replication/sink/filersink/filer_sink.go +++ b/weed/replication/sink/filersink/filer_sink.go @@ -98,7 +98,7 @@ func (fs *FilerSink) CreateEntry(ctx context.Context, key string, entry *filer_p Name: name, } glog.V(1).Infof("lookup: %v", lookupRequest) - if resp, err := client.LookupDirectoryEntry(ctx, lookupRequest); err == nil { + if resp, err := client.LookupDirectoryEntry(ctx, lookupRequest); err == nil && resp.Entry != nil { if filer2.ETag(resp.Entry.Chunks) == filer2.ETag(entry.Chunks) { glog.V(0).Infof("already replicated %s", key) return nil @@ -153,6 +153,9 @@ func (fs *FilerSink) UpdateEntry(ctx context.Context, key string, oldEntry *file glog.V(0).Infof("lookup %s: %v", key, err) return err } + if resp.Entry == nil { + return filer2.ErrNotFound + } existingEntry = resp.Entry |
