diff --git a/pkg/local_object_storage/shard/gc.go b/pkg/local_object_storage/shard/gc.go index 8363ebf96..9b916c1fc 100644 --- a/pkg/local_object_storage/shard/gc.go +++ b/pkg/local_object_storage/shard/gc.go @@ -158,12 +158,16 @@ func (s *Shard) removeGarbage() { buf := make([]*object.Address, 0, s.rmBatchSize) // iterate over metabase graveyard and accumulate - // objects with GC mark + // objects with GC mark (no more the s.rmBatchSize objects) err := s.metaBase.IterateOverGraveyard(func(g *meta.Grave) error { if g.WithGCMark() { buf = append(buf, g.Address()) } + if len(buf) == s.rmBatchSize { + return meta.ErrInterruptIterator + } + return nil }) if err != nil {