Skip to content

Commit

Permalink
revert no-warmup
Browse files Browse the repository at this point in the history
  • Loading branch information
ZenGround0 committed Dec 27, 2024
1 parent bb6d93a commit a824321
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 51 deletions.
4 changes: 0 additions & 4 deletions blockstore/splitstore/splitstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,6 @@ type Config struct {
// from the hotstore should be written to the cold store
UniversalColdBlocks bool

// FullWarmup indicates to do a chain traversal upon splitstore init to copy
// from cold store to hot store
FullWarmup bool

// HotstoreMessageRetention indicates the hotstore retention policy for messages.
// It has the following semantics:
// - a value of 0 will only retain messages within the compaction boundary (4 finalities)
Expand Down
4 changes: 2 additions & 2 deletions blockstore/splitstore/splitstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,11 @@ func testSplitStore(t *testing.T, cfg *Config) {
hotCnt := countBlocks(hot)

if coldCnt != 2 {
t.Errorf("expected %d blocks, but got %d", 2, coldCnt)
t.Fatalf("expected %d blocks, but got %d", 2, coldCnt)
}

if hotCnt != 12 {
t.Errorf("expected %d blocks, but got %d", 12, hotCnt)
t.Fatalf("expected %d blocks, but got %d", 12, hotCnt)
}

// trigger a compaction
Expand Down
43 changes: 6 additions & 37 deletions blockstore/splitstore/splitstore_warmup.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import (
var (
// WarmupBoundary is the number of epochs to load state during warmup.
WarmupBoundary = policy.ChainFinality
// Empirically taken from December 2024
MarkSetEstimate int64 = 10_000_000_000
)

// warmup acquires the compaction lock and spawns a goroutine to warm up the hotstore;
Expand All @@ -37,12 +35,8 @@ func (s *SplitStore) warmup(curTs *types.TipSet) error {
log.Info("warming up hotstore")
start := time.Now()

var err error
if s.cfg.FullWarmup {
err = s.doWarmup(curTs)
} else {
err = s.doWarmup2(curTs)
}
err := s.doWarmup(curTs)

if err != nil {
log.Errorf("error warming up hotstore: %s", err)
return
Expand All @@ -54,36 +48,11 @@ func (s *SplitStore) warmup(curTs *types.TipSet) error {
return nil
}

// Warmup2
func (s *SplitStore) doWarmup2(curTs *types.TipSet) error {
log.Infow("warmup starting")

epoch := curTs.Height()
s.markSetSize = MarkSetEstimate
err := s.ds.Put(s.ctx, markSetSizeKey, int64ToBytes(s.markSetSize))
if err != nil {
log.Warnf("error saving mark set size: %s", err)
}

// save the warmup epoch
err = s.ds.Put(s.ctx, warmupEpochKey, epochToBytes(epoch))
if err != nil {
return xerrors.Errorf("error saving warm up epoch: %w", err)
}
s.warmupEpoch.Store(int64(epoch))

// also save the compactionIndex, as this is used as an indicator of warmup for upgraded nodes
err = s.ds.Put(s.ctx, compactionIndexKey, int64ToBytes(s.compactionIndex))
if err != nil {
return xerrors.Errorf("error saving compaction index: %w", err)
}
return nil
}

// the full warmup procedure
// this was standard warmup before we wrote snapshots directly to the hotstore
// now this is used only if explicitly configured. A good use case for this is
// when starting splitstore off of an unpruned full node.
// Most of this is unnecessary in the common case where we are starting from a snapshot
// since snapshots are now loaded directly to the hotstore. However this is safe and robust,
// handling all cases where we are transition from a universal setup to a splitstore setup.
// And warmup costs are only paid on init so it is not
func (s *SplitStore) doWarmup(curTs *types.TipSet) error {
var boundaryEpoch abi.ChainEpoch
epoch := curTs.Height()
Expand Down
1 change: 0 additions & 1 deletion node/config/def.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ func DefaultFullNode() *FullNode {
ColdStoreType: "discard",
HotStoreType: "badger",
MarkSetType: "badger",
FullWarmup: false,

HotStoreFullGCFrequency: 20,
HotStoreMaxSpaceTarget: 650_000_000_000,
Expand Down
6 changes: 0 additions & 6 deletions node/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,12 +523,6 @@ type Splitstore struct {
// is set. Moving GC will not occur when total moving size exceeds
// HotstoreMaxSpaceTarget - HotstoreMaxSpaceSafetyBuffer
HotstoreMaxSpaceSafetyBuffer uint64

// Perform a full warmup from the coldstore to the hotstore upon splitstore startup.
// This is useful in the case you are migrating from a non-splitstore setup to splitstore.
// This should be false in the common case where a node is initialized from a snapshot
// since snapshots are loaded directly to the hotstore.
FullWarmup bool
}

// Full Node
Expand Down
1 change: 0 additions & 1 deletion node/modules/blockstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ func SplitBlockstore(cfg *config.Chainstore) func(lc fx.Lifecycle, r repo.Locked
MarkSetType: cfg.Splitstore.MarkSetType,
DiscardColdBlocks: cfg.Splitstore.ColdStoreType == "discard",
UniversalColdBlocks: cfg.Splitstore.ColdStoreType == "universal",
FullWarmup: cfg.Splitstore.FullWarmup,

HotStoreMessageRetention: cfg.Splitstore.HotStoreMessageRetention,
HotStoreFullGCFrequency: cfg.Splitstore.HotStoreFullGCFrequency,
Expand Down

0 comments on commit a824321

Please sign in to comment.