diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-05-06 03:31:40 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-05-06 03:31:40 -0700 |
| commit | 38f411219a759709b53101d3ecd3ed05c36a6efa (patch) | |
| tree | 3689968bdd7ad1a24fa0405c3423c4cf84e69a9d /weed/filesys/wfs_write.go | |
| parent | c899bdf0636488dc55c6788cc41ce2329f58a39f (diff) | |
| download | seaweedfs-38f411219a759709b53101d3ecd3ed05c36a6efa.tar.xz seaweedfs-38f411219a759709b53101d3ecd3ed05c36a6efa.zip | |
mount: skip local chunk cache if opened write only
Diffstat (limited to 'weed/filesys/wfs_write.go')
| -rw-r--r-- | weed/filesys/wfs_write.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/weed/filesys/wfs_write.go b/weed/filesys/wfs_write.go index dbec3bebc..9d2ce26ec 100644 --- a/weed/filesys/wfs_write.go +++ b/weed/filesys/wfs_write.go @@ -13,7 +13,7 @@ import ( "github.com/chrislusf/seaweedfs/weed/util" ) -func (wfs *WFS) saveDataAsChunk(fullPath util.FullPath) filer.SaveDataAsChunkFunctionType { +func (wfs *WFS) saveDataAsChunk(fullPath util.FullPath, writeOnly bool) filer.SaveDataAsChunkFunctionType { return func(reader io.Reader, filename string, offset int64) (chunk *filer_pb.FileChunk, collection, replication string, err error) { var fileId, host string @@ -67,7 +67,9 @@ func (wfs *WFS) saveDataAsChunk(fullPath util.FullPath) filer.SaveDataAsChunkFun return nil, "", "", fmt.Errorf("upload result: %v", uploadResult.Error) } - wfs.chunkCache.SetChunk(fileId, data) + if !writeOnly { + wfs.chunkCache.SetChunk(fileId, data) + } chunk = uploadResult.ToPbFileChunk(fileId, offset) return chunk, collection, replication, nil |
