Skip to content

Commit

Permalink
Make garbage collector fetch meta after list from storage (#27205) (#…
Browse files Browse the repository at this point in the history
…27369)

Signed-off-by: Congqi Xia <[email protected]>
  • Loading branch information
congqixia authored Sep 26, 2023
1 parent fe92ae3 commit 49ef097
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions internal/datacoord/garbage_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,18 @@ func (gc *garbageCollector) scan() {
total = 0
valid = 0
missing = 0

segmentMap = typeutil.NewUniqueSet()
filesMap = typeutil.NewSet[string]()
)
segments := gc.meta.GetAllSegmentsUnsafe()
for _, segment := range segments {
segmentMap.Insert(segment.GetID())
for _, log := range getLogs(segment) {
filesMap.Insert(log.GetLogPath())
getMetaMap := func() (typeutil.UniqueSet, typeutil.Set[string]) {
segmentMap := typeutil.NewUniqueSet()
filesMap := typeutil.NewSet[string]()
segments := gc.meta.GetAllSegmentsUnsafe()
for _, segment := range segments {
segmentMap.Insert(segment.GetID())
for _, log := range getLogs(segment) {
filesMap.Insert(log.GetLogPath())
}
}
return segmentMap, filesMap
}

// walk only data cluster related prefixes
Expand All @@ -155,6 +157,7 @@ func (gc *garbageCollector) scan() {
zap.String("error", err.Error()),
)
}
segmentMap, filesMap := getMetaMap()
log.Info("gc scan finish list object", zap.String("prefix", prefix), zap.Duration("time spent", time.Since(startTs)), zap.Int("keys", len(infoKeys)))
for i, infoKey := range infoKeys {
total++
Expand Down

0 comments on commit 49ef097

Please sign in to comment.