forked from TrueCloudLab/frostfs-node
[#378] shard/gc: Limit the accumulated batch of objects to be deleted
Change Shard's garbage remover to interrupt iterating over the metabase graveyard when the buffer is full to the max size (`WithRemoverBatchSize` Shard's option). Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
f5f416268f
commit
72f7df3339
1 changed files with 5 additions and 1 deletions
|
@ -158,12 +158,16 @@ func (s *Shard) removeGarbage() {
|
||||||
buf := make([]*object.Address, 0, s.rmBatchSize)
|
buf := make([]*object.Address, 0, s.rmBatchSize)
|
||||||
|
|
||||||
// iterate over metabase graveyard and accumulate
|
// 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 {
|
err := s.metaBase.IterateOverGraveyard(func(g *meta.Grave) error {
|
||||||
if g.WithGCMark() {
|
if g.WithGCMark() {
|
||||||
buf = append(buf, g.Address())
|
buf = append(buf, g.Address())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(buf) == s.rmBatchSize {
|
||||||
|
return meta.ErrInterruptIterator
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue