minor tweaks in purge
- allocate once - log purge count
This commit is contained in:
parent
cb665d07e0
commit
65ccc99e79
@ -1139,9 +1139,13 @@ func (s *SplitStore) purgeBatch(cids []cid.Cid, deleteBatch func([]cid.Cid) erro
|
||||
}
|
||||
|
||||
func (s *SplitStore) purge(curTs *types.TipSet, cids []cid.Cid) error {
|
||||
deadCids := make([]cid.Cid, 0, batchSize)
|
||||
purgeCnt := 0
|
||||
defer log.Infof("purged %d objects", purgeCnt)
|
||||
|
||||
return s.purgeBatch(cids,
|
||||
func(cids []cid.Cid) error {
|
||||
deadCids := make([]cid.Cid, 0, len(cids))
|
||||
deadCids := deadCids[:0]
|
||||
|
||||
s.txnLk.Lock()
|
||||
defer s.txnLk.Unlock()
|
||||
@ -1170,6 +1174,8 @@ func (s *SplitStore) purge(curTs *types.TipSet, cids []cid.Cid) error {
|
||||
return xerrors.Errorf("error purging cold objects: %w", err)
|
||||
}
|
||||
|
||||
purgeCnt += len(deadCids)
|
||||
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user