From 17091198ae7802619239c086412bfbe29ba6dfc8 Mon Sep 17 00:00:00 2001 From: vyzo Date: Sun, 27 Jun 2021 15:46:51 +0300 Subject: [PATCH] use internal get during walk to avoid blowing the compaction txn otherwise the walk itself precludes purge... duh! --- blockstore/splitstore/splitstore.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/blockstore/splitstore/splitstore.go b/blockstore/splitstore/splitstore.go index 074b85360b8..8b5fd8f53a4 100644 --- a/blockstore/splitstore/splitstore.go +++ b/blockstore/splitstore/splitstore.go @@ -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) }