diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2022-03-16 23:20:56 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-16 23:20:56 -0700 |
| commit | d2acde2a61e659dc91236977d1d36394a56b792f (patch) | |
| tree | a7d9b474659e0311ed3ddaee9dbb0e48de591cef /weed/filer/filer.go | |
| parent | 2aa9d9f84ac466e348821066f6332a8a5b777d47 (diff) | |
| parent | 40b0033fa78f7e64c5ac912382cfc8d5bbd76654 (diff) | |
| download | seaweedfs-d2acde2a61e659dc91236977d1d36394a56b792f.tar.xz seaweedfs-d2acde2a61e659dc91236977d1d36394a56b792f.zip | |
Merge pull request #2761 from zhuqunzhou/master
filer: support uploading file without needEnsureParentDir
Diffstat (limited to 'weed/filer/filer.go')
| -rw-r--r-- | weed/filer/filer.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/weed/filer/filer.go b/weed/filer/filer.go index 0f34adb4d..193202889 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()) |
