Skip to content

Commit

Permalink
use internal get during walk to avoid blowing the compaction txn
Browse files Browse the repository at this point in the history
otherwise the walk itself precludes purge... duh!
  • Loading branch information
vyzo committed Jun 27, 2021
1 parent 4af1c8b commit 1709119
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions blockstore/splitstore/splitstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 1709119

Please sign in to comment.