Browse Source

minor optimization

pull/1427/head
Chris Lu 4 years ago
parent
commit
24c8e6bcb4
  1. 9
      weed/filesys/meta_cache/meta_cache.go

9
weed/filesys/meta_cache/meta_cache.go

@ -61,8 +61,13 @@ func (mc *MetaCache) AtomicUpdateEntry(ctx context.Context, oldPath util.FullPat
oldDir, _ := oldPath.DirAndName() oldDir, _ := oldPath.DirAndName()
if mc.visitedBoundary.HasVisited(util.FullPath(oldDir)) { if mc.visitedBoundary.HasVisited(util.FullPath(oldDir)) {
if oldPath != "" { if oldPath != "" {
if err := mc.actualStore.DeleteEntry(ctx, oldPath); err != nil {
return err
if oldPath == newEntry.FullPath {
// skip the unnecessary deletion
// leave the update to the following InsertEntry operation
} else {
if err := mc.actualStore.DeleteEntry(ctx, oldPath); err != nil {
return err
}
} }
} }
} else { } else {

Loading…
Cancel
Save