synchronously mark live refs on put/putmany

This commit is contained in:
vyzo 2022-02-01 09:07:14 +02:00
parent 37673c6de6
commit 3aabb0314a

View File

@ -370,10 +370,10 @@ func (s *SplitStore) Put(ctx context.Context, blk blocks.Block) error {
}
s.txnLk.RLock()
defer s.txnLk.RUnlock()
err := s.hot.Put(ctx, blk)
if err != nil {
s.txnLk.RUnlock()
return err
}
@ -381,13 +381,9 @@ func (s *SplitStore) Put(ctx context.Context, blk blocks.Block) error {
// critical section
if s.txnMarkSet != nil {
go func() {
defer s.txnLk.RUnlock()
s.markLiveRefs([]cid.Cid{blk.Cid()})
}()
s.markLiveRefs([]cid.Cid{blk.Cid()})
return nil
}
defer s.txnLk.RUnlock()
s.trackTxnRef(blk.Cid())
return nil
@ -425,10 +421,10 @@ func (s *SplitStore) PutMany(ctx context.Context, blks []blocks.Block) error {
}
s.txnLk.RLock()
defer s.txnLk.RUnlock()
err := s.hot.PutMany(ctx, blks)
if err != nil {
s.txnLk.RUnlock()
return err
}
@ -436,13 +432,9 @@ func (s *SplitStore) PutMany(ctx context.Context, blks []blocks.Block) error {
// critical section
if s.txnMarkSet != nil {
go func() {
defer s.txnLk.RUnlock()
s.markLiveRefs(batch)
}()
s.markLiveRefs(batch)
return nil
}
defer s.txnLk.RUnlock()
s.trackTxnRefMany(batch)
return nil