more efficient trackTxnRefMany

This commit is contained in:
vyzo 2021-07-04 10:14:58 +03:00
parent 36f93649ef
commit eafffc1634

View File

@ -650,15 +650,25 @@ func (s *SplitStore) trackTxnRefMany(cids []cid.Cid) error {
return nil return nil
} }
var err error if s.txnRefs != nil {
// we haven't finished marking yet, so track the reference
s.txnRefsMx.Lock()
for _, c := range cids { for _, c := range cids {
err2 := s.trackTxnRef(c, false) s.txnRefs[c] = struct{}{}
if err2 != nil { }
err = multierr.Combine(err, err2) s.txnRefsMx.Unlock()
return nil
}
// we have finished marking, protect the refs
for _, c := range cids {
err := s.txnProtect.Mark(c)
if err != nil {
return err
} }
} }
return err return nil
} }
func (s *SplitStore) warmup(curTs *types.TipSet) error { func (s *SplitStore) warmup(curTs *types.TipSet) error {