diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-08-17 10:03:34 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-08-17 10:03:34 -0700 |
| commit | 24c8e6bcb4f06c7cab1dec4bd44c0cd48f976c79 (patch) | |
| tree | 2fc39b76497403c5666b825ba297721f5e048724 | |
| parent | f5837b700079b8ad5cf52a7a4996ab49a57b4289 (diff) | |
| download | seaweedfs-24c8e6bcb4f06c7cab1dec4bd44c0cd48f976c79.tar.xz seaweedfs-24c8e6bcb4f06c7cab1dec4bd44c0cd48f976c79.zip | |
minor optimization
| -rw-r--r-- | weed/filesys/meta_cache/meta_cache.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/weed/filesys/meta_cache/meta_cache.go b/weed/filesys/meta_cache/meta_cache.go index edf329143..69a016c23 100644 --- a/weed/filesys/meta_cache/meta_cache.go +++ b/weed/filesys/meta_cache/meta_cache.go @@ -61,8 +61,13 @@ func (mc *MetaCache) AtomicUpdateEntry(ctx context.Context, oldPath util.FullPat oldDir, _ := oldPath.DirAndName() if mc.visitedBoundary.HasVisited(util.FullPath(oldDir)) { 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 { |
