walk snapshot the same way snapshot exporting does; skip old msgs and receipts by default.

so that we don't panic with missing blocks in non-archival nodes
This commit is contained in:
vyzo 2021-02-26 17:14:10 +02:00
parent 5068d51ac3
commit 31268ba685

View File

@ -43,6 +43,8 @@ type SplitStore struct {
compacting int32 compacting int32
enableGC bool // TODO disabled for now, as it needs testing enableGC bool // TODO disabled for now, as it needs testing
skipOldMsgs bool // TODO this should be false for full archival nodes
skipMsgReceipts bool // TODO this should be false for full archival nodes
baseEpoch abi.ChainEpoch baseEpoch abi.ChainEpoch
@ -84,6 +86,9 @@ func NewSplitStore(path string, ds dstore.Datastore, cold, hot bstore.Blockstore
cold: cold, cold: cold,
snoop: snoop, snoop: snoop,
env: env, env: env,
enableGC: false, // TODO option for this
skipOldMsgs: true, // TODO option for this
skipMsgReceipts: true, // TODO option for this
} }
return ss, nil return ss, nil
@ -342,7 +347,7 @@ func (s *SplitStore) compact() {
epoch := curTs.Height() epoch := curTs.Height()
coldEpoch := s.baseEpoch + CompactionCold coldEpoch := s.baseEpoch + CompactionCold
err = s.cs.WalkSnapshot(context.Background(), curTs, epoch-coldEpoch, false, false, err = s.cs.WalkSnapshot(context.Background(), curTs, epoch-coldEpoch, s.skipOldMsgs, s.skipMsgReceipts,
func(cid cid.Cid) error { func(cid cid.Cid) error {
return hotSet.Mark(cid) return hotSet.Mark(cid)
}) })
@ -359,7 +364,7 @@ func (s *SplitStore) compact() {
panic(err) panic(err)
} }
err = s.cs.WalkSnapshot(context.Background(), coldTs, CompactionCold, false, false, err = s.cs.WalkSnapshot(context.Background(), coldTs, CompactionCold, s.skipOldMsgs, s.skipMsgReceipts,
func(cid cid.Cid) error { func(cid cid.Cid) error {
return coldSet.Mark(cid) return coldSet.Mark(cid)
}) })