do tracker purge in smaller batches
This commit is contained in:
parent
6b8c60a659
commit
6b680d112b
@ -727,10 +727,25 @@ func (s *SplitStore) purgeBlocks(cids []cid.Cid) error {
|
||||
}
|
||||
|
||||
func (s *SplitStore) purgeTracking(cids []cid.Cid) error {
|
||||
err := s.tracker.DeleteBatch(cids)
|
||||
if len(cids) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
// don't delete one giant batch of 7M objects, but rather do smaller batches
|
||||
done := false
|
||||
for i := 0; done; i++ {
|
||||
start := i * batchSize
|
||||
end := start + batchSize
|
||||
if end >= len(cids) {
|
||||
end = len(cids)
|
||||
done = true
|
||||
}
|
||||
|
||||
err := s.tracker.DeleteBatch(cids[start:end])
|
||||
if err != nil {
|
||||
return xerrors.Errorf("error deleting batch from tracker: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user