use internal get during walk to avoid blowing the compaction txn

otherwise the walk itself precludes purge... duh!
This commit is contained in:
vyzo 2021-06-27 15:46:51 +03:00
parent 6af3a23dd4
commit 31497f4bd3

View File

@ -263,6 +263,19 @@ func (s *SplitStore) Get(cid cid.Cid) (blocks.Block, error) {
}
}
// internal version used by walk so that we don't blow the txn
func (s *SplitStore) get(cid cid.Cid) (blocks.Block, error) {
blk, err := s.hot.Get(cid)
switch err {
case bstore.ErrNotFound:
return s.cold.Get(cid)
default:
return blk, err
}
}
func (s *SplitStore) GetSize(cid cid.Cid) (int, error) {
s.txnLk.RLock()
defer s.txnLk.RUnlock()
@ -986,7 +999,7 @@ func (s *SplitStore) walk(ts *types.TipSet, boundary abi.ChainEpoch, inclMsgs bo
return nil
}
blk, err := s.Get(c)
blk, err := s.get(c)
if err != nil {
return xerrors.Errorf("error retrieving block (cid: %s): %w", c, err)
}
@ -1053,7 +1066,7 @@ func (s *SplitStore) walkLinks(c cid.Cid, walked *cid.Set, f func(cid.Cid) error
return nil
}
blk, err := s.Get(c)
blk, err := s.get(c)
if err != nil {
return xerrors.Errorf("error retrieving linked block (cid: %s): %w", c, err)
}