Browse Source

delete chunks only when file writing is successful

pull/991/head
Chris Lu 6 years ago
parent
commit
4b0f084b5d
  1. 3
      weed/filesys/filehandle.go

3
weed/filesys/filehandle.go

@ -160,12 +160,13 @@ func (fh *FileHandle) Flush(ctx context.Context, req *fuse.FlushRequest) error {
chunks, garbages := filer2.CompactFileChunks(fh.f.entry.Chunks) chunks, garbages := filer2.CompactFileChunks(fh.f.entry.Chunks)
fh.f.entry.Chunks = chunks fh.f.entry.Chunks = chunks
// fh.f.entryViewCache = nil // fh.f.entryViewCache = nil
fh.f.wfs.deleteFileChunks(ctx, garbages)
if _, err := client.CreateEntry(ctx, request); err != nil { if _, err := client.CreateEntry(ctx, request); err != nil {
return fmt.Errorf("update fh: %v", err) return fmt.Errorf("update fh: %v", err)
} }
fh.f.wfs.deleteFileChunks(ctx, garbages)
return nil return nil
}) })
} }

Loading…
Cancel
Save