aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2023-01-10 00:48:01 -0800
committerchrislu <chris.lu@gmail.com>2023-01-10 00:48:01 -0800
commite650c8397daa0572e848ce425d92ac1d2294f531 (patch)
tree8aa4fe41ed5c6c16e5c6b05e0b7f9cce00cae541
parent75bdd4a0d1caa5af940397793fe0decc3da1093e (diff)
downloadseaweedfs-e650c8397daa0572e848ce425d92ac1d2294f531.tar.xz
seaweedfs-e650c8397daa0572e848ce425d92ac1d2294f531.zip
ensure section.chunks is always garbage free
-rw-r--r--weed/filer/filechunk_section.go4
1 files changed, 3 insertions, 1 deletions
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)