diff options
| author | hilimd <68371223+hilimd@users.noreply.github.com> | 2020-07-21 14:08:18 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-21 14:08:18 +0800 |
| commit | 6ea4ce722704171fdbddba61f423202a620b6ecf (patch) | |
| tree | b4e3e1deb1133cc7d34757c0981e30dabe196a03 /weed/filesys/filehandle.go | |
| parent | 5850bb733936399babbe2d77f4b27cac312e2798 (diff) | |
| parent | 885c624bceb61688c806b91350e70d75088c6eea (diff) | |
| download | seaweedfs-6ea4ce722704171fdbddba61f423202a620b6ecf.tar.xz seaweedfs-6ea4ce722704171fdbddba61f423202a620b6ecf.zip | |
Merge pull request #3 from chrislusf/master
sync
Diffstat (limited to 'weed/filesys/filehandle.go')
| -rw-r--r-- | weed/filesys/filehandle.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.go index 9b9df916c..31fd08f97 100644 --- a/weed/filesys/filehandle.go +++ b/weed/filesys/filehandle.go @@ -88,8 +88,12 @@ func (fh *FileHandle) readFromChunks(buff []byte, offset int64) (int64, error) { return 0, nil } + var chunkResolveErr error if fh.f.entryViewCache == nil { - fh.f.entryViewCache = filer2.NonOverlappingVisibleIntervals(fh.f.entry.Chunks) + fh.f.entryViewCache, chunkResolveErr = filer2.NonOverlappingVisibleIntervals(filer2.LookupFn(fh.f.wfs), fh.f.entry.Chunks) + if chunkResolveErr != nil { + return 0, fmt.Errorf("fail to resolve chunk manifest: %v", chunkResolveErr) + } fh.f.reader = nil } @@ -206,7 +210,12 @@ func (fh *FileHandle) Flush(ctx context.Context, req *fuse.FlushRequest) error { glog.V(3).Infof("%s chunks %d: %v [%d,%d)", fh.f.fullpath(), i, chunk.FileId, chunk.Offset, chunk.Offset+int64(chunk.Size)) } - chunks, garbages := filer2.CompactFileChunks(fh.f.entry.Chunks) + chunks, garbages := filer2.CompactFileChunks(filer2.LookupFn(fh.f.wfs), fh.f.entry.Chunks) + chunks, manifestErr := filer2.MaybeManifestize(fh.f.wfs.saveDataAsChunk(fh.f.dir.FullPath()), chunks) + if manifestErr != nil { + // not good, but should be ok + glog.V(0).Infof("MaybeManifestize: %v", manifestErr) + } fh.f.entry.Chunks = chunks // fh.f.entryViewCache = nil |
