From e650c8397daa0572e848ce425d92ac1d2294f531 Mon Sep 17 00:00:00 2001 From: chrislu Date: Tue, 10 Jan 2023 00:48:01 -0800 Subject: [PATCH] ensure section.chunks is always garbage free --- weed/filer/filechunk_section.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/weed/filer/filechunk_section.go b/weed/filer/filechunk_section.go index 3fbfb396d..c3c5f6510 100644 --- a/weed/filer/filechunk_section.go +++ b/weed/filer/filechunk_section.go @@ -30,7 +30,9 @@ func (section *FileChunkSection) addChunk(chunk *filer_pb.FileChunk) error { section.chunks = append(section.chunks, chunk) - if section.visibleIntervals != nil { + if section.visibleIntervals == nil { + section.visibleIntervals = readResolvedChunks(section.chunks, int64(section.sectionIndex)*SectionSize, (int64(section.sectionIndex)+1)*SectionSize) + } else { MergeIntoVisibles(section.visibleIntervals, start, stop, chunk) garbageFileIds := FindGarbageChunks(section.visibleIntervals, start, stop) removeGarbageChunks(section, garbageFileIds)