aboutsummaryrefslogtreecommitdiff
path: root/weed/filer/filer.go
diff options
context:
space:
mode:
authorKonstantin Lebedev <lebedev_k@tochka.com>2020-12-01 16:03:34 +0500
committerKonstantin Lebedev <lebedev_k@tochka.com>2020-12-01 16:03:34 +0500
commit03620776ece3175dac979b05c491d26d14faef0f (patch)
tree4fce7d0a55c3fa7f5b7c43e9d90d5e194c439239 /weed/filer/filer.go
parent4e55baf5b109cfe5cf9f65c44cd92c542b4acf5e (diff)
parent005a6123e98170b2bdf99eb5b8a67ca3cea94190 (diff)
downloadseaweedfs-03620776ece3175dac979b05c491d26d14faef0f.tar.xz
seaweedfs-03620776ece3175dac979b05c491d26d14faef0f.zip
Merge branch 'upstream_master' into store_s3cred
Diffstat (limited to 'weed/filer/filer.go')
-rw-r--r--weed/filer/filer.go13
1 files changed, 3 insertions, 10 deletions
diff --git a/weed/filer/filer.go b/weed/filer/filer.go
index 105c8e04f..8319212f1 100644
--- a/weed/filer/filer.go
+++ b/weed/filer/filer.go
@@ -238,6 +238,7 @@ func (f *Filer) CreateEntry(ctx context.Context, entry *Entry, o_excl bool, isFr
func (f *Filer) UpdateEntry(ctx context.Context, oldEntry, entry *Entry) (err error) {
if oldEntry != nil {
+ entry.Attr.Crtime = oldEntry.Attr.Crtime
if oldEntry.IsDirectory() && !entry.IsDirectory() {
glog.Errorf("existing %s is a directory", entry.FullPath)
return fmt.Errorf("existing %s is a directory", entry.FullPath)
@@ -269,7 +270,7 @@ func (f *Filer) FindEntry(ctx context.Context, p util.FullPath) (entry *Entry, e
entry, err = f.Store.FindEntry(ctx, p)
if entry != nil && entry.TtlSec > 0 {
if entry.Crtime.Add(time.Duration(entry.TtlSec) * time.Second).Before(time.Now()) {
- f.Store.DeleteEntry(ctx, p.Child(entry.Name()))
+ f.Store.DeleteOneEntry(ctx, entry)
return nil, filer_pb.ErrNotFound
}
}
@@ -303,7 +304,7 @@ func (f *Filer) doListDirectoryEntries(ctx context.Context, p util.FullPath, sta
lastFileName = entry.Name()
if entry.TtlSec > 0 {
if entry.Crtime.Add(time.Duration(entry.TtlSec) * time.Second).Before(time.Now()) {
- f.Store.DeleteEntry(ctx, p.Child(entry.Name()))
+ f.Store.DeleteOneEntry(ctx, entry)
expiredCount++
continue
}
@@ -317,11 +318,3 @@ func (f *Filer) Shutdown() {
f.LocalMetaLogBuffer.Shutdown()
f.Store.Shutdown()
}
-
-func (f *Filer) maybeDeleteHardLinks(hardLinkIds []HardLinkId) {
- for _, hardLinkId := range hardLinkIds {
- if err := f.Store.DeleteHardLink(context.Background(), hardLinkId); err != nil {
- glog.Errorf("delete hard link id %d : %v", hardLinkId, err)
- }
- }
-}