do tracker purge in smaller batches
This commit is contained in:
parent
6b8c60a659
commit
6b680d112b
@ -727,9 +727,24 @@ func (s *SplitStore) purgeBlocks(cids []cid.Cid) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *SplitStore) purgeTracking(cids []cid.Cid) error {
|
func (s *SplitStore) purgeTracking(cids []cid.Cid) error {
|
||||||
err := s.tracker.DeleteBatch(cids)
|
if len(cids) == 0 {
|
||||||
if err != nil {
|
return nil
|
||||||
return xerrors.Errorf("error deleting batch from tracker: %w", err)
|
}
|
||||||
|
|
||||||
|
// 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
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user