use CompactionCold epochs for delinating the cold epoch cliff

this allows us to change the thresholds for testing.
This commit is contained in:
vyzo 2021-02-26 16:59:03 +02:00
parent d44719dbd3
commit 5068d51ac3

View File

@ -25,7 +25,10 @@ import (
bstore "github.com/filecoin-project/lotus/lib/blockstore" bstore "github.com/filecoin-project/lotus/lib/blockstore"
) )
var CompactionThreshold = 5 * build.Finality const (
CompactionThreshold = 5 * build.Finality
CompactionCold = build.Finality
)
var baseEpochKey = dstore.NewKey("baseEpoch") var baseEpochKey = dstore.NewKey("baseEpoch")
@ -338,7 +341,7 @@ func (s *SplitStore) compact() {
s.mx.Unlock() s.mx.Unlock()
epoch := curTs.Height() epoch := curTs.Height()
coldEpoch := s.baseEpoch + build.Finality coldEpoch := s.baseEpoch + CompactionCold
err = s.cs.WalkSnapshot(context.Background(), curTs, epoch-coldEpoch, false, false, err = s.cs.WalkSnapshot(context.Background(), curTs, epoch-coldEpoch, false, false,
func(cid cid.Cid) error { func(cid cid.Cid) error {
return hotSet.Mark(cid) return hotSet.Mark(cid)
@ -356,7 +359,7 @@ func (s *SplitStore) compact() {
panic(err) panic(err)
} }
err = s.cs.WalkSnapshot(context.Background(), coldTs, build.Finality, false, false, err = s.cs.WalkSnapshot(context.Background(), coldTs, CompactionCold, false, false,
func(cid cid.Cid) error { func(cid cid.Cid) error {
return coldSet.Mark(cid) return coldSet.Mark(cid)
}) })