diff options
| author | chrislu <chris.lu@gmail.com> | 2023-01-10 00:46:46 -0800 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2023-01-10 00:46:46 -0800 |
| commit | 75bdd4a0d1caa5af940397793fe0decc3da1093e (patch) | |
| tree | 2f38fb005d1e81dec4d4fa57f53e6455c4fd263f /weed/filer/filechunks.go | |
| parent | 51d4a4b28d0edcd01ab1faa19f8a80f4137fc497 (diff) | |
| download | seaweedfs-75bdd4a0d1caa5af940397793fe0decc3da1093e.tar.xz seaweedfs-75bdd4a0d1caa5af940397793fe0decc3da1093e.zip | |
refactor
Diffstat (limited to 'weed/filer/filechunks.go')
| -rw-r--r-- | weed/filer/filechunks.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/weed/filer/filechunks.go b/weed/filer/filechunks.go index 480478fd7..7c8bb2fe1 100644 --- a/weed/filer/filechunks.go +++ b/weed/filer/filechunks.go @@ -86,12 +86,13 @@ func SeparateGarbageChunks(visibles *IntervalList[*VisibleInterval], chunks []*f return compacted, garbage } -func FindGarbageChunks(visibles *IntervalList[*VisibleInterval], start int64, stop int64) (garbageFileId []string) { +func FindGarbageChunks(visibles *IntervalList[*VisibleInterval], start int64, stop int64) (garbageFileIds map[string]struct{}) { + garbageFileIds = make(map[string]struct{}) for x := visibles.Front(); x != nil; x = x.Next { interval := x.Value offset := interval.start - interval.offsetInChunk if start <= offset && offset+int64(interval.chunkSize) <= stop { - garbageFileId = append(garbageFileId, interval.fileId) + garbageFileIds[interval.fileId] = struct{}{} } } return |
