diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-08-23 16:59:01 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-08-23 16:59:01 -0700 |
| commit | c1d1677a2861121b2d1e954b0c700d848bf8ea84 (patch) | |
| tree | d5ed2d19f543f0e913d1a4e610b19426fbbb3c5c | |
| parent | 98175548c27ba604fe0443bff38e07ec019d2495 (diff) | |
| download | seaweedfs-c1d1677a2861121b2d1e954b0c700d848bf8ea84.tar.xz seaweedfs-c1d1677a2861121b2d1e954b0c700d848bf8ea84.zip | |
keep manifest chunks forever
| -rw-r--r-- | weed/filesys/filehandle.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.go index 0b6aeddd2..226ade962 100644 --- a/weed/filesys/filehandle.go +++ b/weed/filesys/filehandle.go @@ -253,13 +253,20 @@ func (fh *FileHandle) doFlush(ctx context.Context, header fuse.Header) error { glog.V(4).Infof("%s chunks %d: %v [%d,%d)", fh.f.fullpath(), i, chunk.GetFileIdString(), chunk.Offset, chunk.Offset+int64(chunk.Size)) } - chunks, _ := filer2.CompactFileChunks(filer2.LookupFn(fh.f.wfs), fh.f.entry.Chunks) + var nonManifestChunks []*filer_pb.FileChunk + for _, c := range fh.f.entry.Chunks { + if !c.IsChunkManifest { + nonManifestChunks = append(nonManifestChunks, c) + } + } + + chunks, _ := filer2.CompactFileChunks(filer2.LookupFn(fh.f.wfs), nonManifestChunks) 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.entry.Chunks = append(chunks, nonManifestChunks...) fh.f.entryViewCache = nil if err := filer_pb.CreateEntry(client, request); err != nil { |
