diff options
| author | chrislu <chris.lu@gmail.com> | 2022-02-25 02:57:54 -0800 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2022-02-25 02:57:54 -0800 |
| commit | 03466f955e7907f5e7442dd3e60c45a3ab261ea3 (patch) | |
| tree | 7b77cf6944e2f24a17a2854637506fc71678bc60 /weed/mount/meta_cache/meta_cache.go | |
| parent | 8080fe4cc19cd2d0479b605ae7ad7993a5bcf50a (diff) | |
| download | seaweedfs-03466f955e7907f5e7442dd3e60c45a3ab261ea3.tar.xz seaweedfs-03466f955e7907f5e7442dd3e60c45a3ab261ea3.zip | |
rename: delete source entry metadata only, skipping hard links
Diffstat (limited to 'weed/mount/meta_cache/meta_cache.go')
| -rw-r--r-- | weed/mount/meta_cache/meta_cache.go | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/weed/mount/meta_cache/meta_cache.go b/weed/mount/meta_cache/meta_cache.go index 7f997c5b0..994f00463 100644 --- a/weed/mount/meta_cache/meta_cache.go +++ b/weed/mount/meta_cache/meta_cache.go @@ -62,7 +62,7 @@ func (mc *MetaCache) doInsertEntry(ctx context.Context, entry *filer.Entry) erro return mc.localStore.InsertEntry(ctx, entry) } -func (mc *MetaCache) AtomicUpdateEntryFromFiler(ctx context.Context, oldPath util.FullPath, newEntry *filer.Entry) error { +func (mc *MetaCache) AtomicUpdateEntryFromFiler(ctx context.Context, oldPath util.FullPath, newEntry *filer.Entry, shouldDeleteChunks bool) error { //mc.Lock() //defer mc.Unlock() @@ -74,8 +74,14 @@ func (mc *MetaCache) AtomicUpdateEntryFromFiler(ctx context.Context, oldPath uti // leave the update to the following InsertEntry operation } else { glog.V(3).Infof("DeleteEntry %s", oldPath) - if err := mc.localStore.DeleteEntry(ctx, oldPath); err != nil { - return err + if shouldDeleteChunks { + if err := mc.localStore.DeleteEntry(ctx, oldPath); err != nil { + return err + } + } else { + if err := mc.localStore.DeleteOneEntrySkipHardlink(ctx, oldPath); err != nil { + return err + } } } } @@ -112,6 +118,12 @@ func (mc *MetaCache) FindEntry(ctx context.Context, fp util.FullPath) (entry *fi return } +func (mc *MetaCache) DeleteEntrySkipHardlink(ctx context.Context, fp util.FullPath) (err error) { + //mc.Lock() + //defer mc.Unlock() + return mc.localStore.DeleteOneEntrySkipHardlink(ctx, fp) +} + func (mc *MetaCache) DeleteEntry(ctx context.Context, fp util.FullPath) (err error) { //mc.Lock() //defer mc.Unlock() |
