synchronously mark live refs on put/putmany
This commit is contained in:
parent
37673c6de6
commit
3aabb0314a
@ -370,10 +370,10 @@ func (s *SplitStore) Put(ctx context.Context, blk blocks.Block) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
s.txnLk.RLock()
|
s.txnLk.RLock()
|
||||||
|
defer s.txnLk.RUnlock()
|
||||||
|
|
||||||
err := s.hot.Put(ctx, blk)
|
err := s.hot.Put(ctx, blk)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.txnLk.RUnlock()
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,13 +381,9 @@ func (s *SplitStore) Put(ctx context.Context, blk blocks.Block) error {
|
|||||||
|
|
||||||
// critical section
|
// critical section
|
||||||
if s.txnMarkSet != nil {
|
if s.txnMarkSet != nil {
|
||||||
go func() {
|
|
||||||
defer s.txnLk.RUnlock()
|
|
||||||
s.markLiveRefs([]cid.Cid{blk.Cid()})
|
s.markLiveRefs([]cid.Cid{blk.Cid()})
|
||||||
}()
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
defer s.txnLk.RUnlock()
|
|
||||||
|
|
||||||
s.trackTxnRef(blk.Cid())
|
s.trackTxnRef(blk.Cid())
|
||||||
return nil
|
return nil
|
||||||
@ -425,10 +421,10 @@ func (s *SplitStore) PutMany(ctx context.Context, blks []blocks.Block) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
s.txnLk.RLock()
|
s.txnLk.RLock()
|
||||||
|
defer s.txnLk.RUnlock()
|
||||||
|
|
||||||
err := s.hot.PutMany(ctx, blks)
|
err := s.hot.PutMany(ctx, blks)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.txnLk.RUnlock()
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -436,13 +432,9 @@ func (s *SplitStore) PutMany(ctx context.Context, blks []blocks.Block) error {
|
|||||||
|
|
||||||
// critical section
|
// critical section
|
||||||
if s.txnMarkSet != nil {
|
if s.txnMarkSet != nil {
|
||||||
go func() {
|
|
||||||
defer s.txnLk.RUnlock()
|
|
||||||
s.markLiveRefs(batch)
|
s.markLiveRefs(batch)
|
||||||
}()
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
defer s.txnLk.RUnlock()
|
|
||||||
|
|
||||||
s.trackTxnRefMany(batch)
|
s.trackTxnRefMany(batch)
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user