fix directory lookup nil

This commit is contained in:
Chris Lu
2020-02-25 11:13:06 -08:00
parent e86da5a491
commit 7d10fdf737
8 changed files with 22 additions and 8 deletions

View File

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