aboutsummaryrefslogtreecommitdiff
path: root/weed/filer/filer.go
diff options
context:
space:
mode:
authorzzq09494 <zzq09494@ly.com>2022-03-17 10:18:23 +0800
committerzzq09494 <zzq09494@ly.com>2022-03-17 10:18:23 +0800
commita93c4947bae0dcf4a276aedf9f84785ccf83f27a (patch)
tree0ea6e95316df79ed3917a452885125d7d0ea5acd /weed/filer/filer.go
parent2aa9d9f84ac466e348821066f6332a8a5b777d47 (diff)
downloadseaweedfs-a93c4947bae0dcf4a276aedf9f84785ccf83f27a.tar.xz
seaweedfs-a93c4947bae0dcf4a276aedf9f84785ccf83f27a.zip
filer: support uploading file without needEnsureParentDir
Diffstat (limited to 'weed/filer/filer.go')
-rw-r--r--weed/filer/filer.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/weed/filer/filer.go b/weed/filer/filer.go
index 0f34adb4d..41f91ce9a 100644
--- a/weed/filer/filer.go
+++ b/weed/filer/filer.go
@@ -151,7 +151,7 @@ func (f *Filer) RollbackTransaction(ctx context.Context) error {
return f.Store.RollbackTransaction(ctx)
}
-func (f *Filer) CreateEntry(ctx context.Context, entry *Entry, o_excl bool, isFromOtherCluster bool, signatures []int32) error {
+func (f *Filer) CreateEntry(ctx context.Context, entry *Entry, o_excl bool, isFromOtherCluster bool, signatures []int32,needEnsureParentDir bool) error {
if string(entry.FullPath) == "/" {
return nil
@@ -169,9 +169,11 @@ func (f *Filer) CreateEntry(ctx context.Context, entry *Entry, o_excl bool, isFr
if oldEntry == nil {
- dirParts := strings.Split(string(entry.FullPath), "/")
- if err := f.ensureParentDirecotryEntry(ctx, entry, dirParts, len(dirParts)-1, isFromOtherCluster); err != nil {
- return err
+ if needEnsureParentDir {
+ dirParts := strings.Split(string(entry.FullPath), "/")
+ if err := f.ensureParentDirecotryEntry(ctx, entry, dirParts, len(dirParts)-1, isFromOtherCluster); err != nil {
+ return err
+ }
}
glog.V(4).Infof("InsertEntry %s: new entry: %v", entry.FullPath, entry.Name())