From 11b2f41804e4a2094c4c271fe1c1f0ebe451fde7 Mon Sep 17 00:00:00 2001 From: vyzo Date: Wed, 3 Mar 2021 09:46:12 +0200 Subject: [PATCH] overestimate markSetSize a bit --- blockstore/splitstore/splitstore.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/blockstore/splitstore/splitstore.go b/blockstore/splitstore/splitstore.go index 67588fe9c..8489e5d8b 100644 --- a/blockstore/splitstore/splitstore.go +++ b/blockstore/splitstore/splitstore.go @@ -518,10 +518,10 @@ func (s *SplitStore) compact(curTs *types.TipSet) { } func (s *SplitStore) estimateMarkSetSize(curTs *types.TipSet) { - s.markSetSize = 0 + var count int64 err := s.chain.WalkSnapshot(context.Background(), curTs, 1, s.skipOldMsgs, s.skipMsgReceipts, func(cid cid.Cid) error { - s.markSetSize++ + count++ return nil }) @@ -529,6 +529,8 @@ func (s *SplitStore) estimateMarkSetSize(curTs *types.TipSet) { // TODO do something better here panic(err) } + + s.markSetSize = count + count>>2 } func (s *SplitStore) compactSimple(curTs *types.TipSet) { @@ -566,7 +568,7 @@ func (s *SplitStore) compactSimple(curTs *types.TipSet) { } if count > s.markSetSize { - s.markSetSize = count + s.markSetSize = count + count>>2 } log.Infow("marking done", "took", time.Since(startMark)) @@ -790,7 +792,7 @@ func (s *SplitStore) compactFull(curTs *types.TipSet) { } if count > s.markSetSize { - s.markSetSize = count + s.markSetSize = count + count>>2 } // Phase 1b: mark all reachable CIDs in the cold range @@ -813,7 +815,7 @@ func (s *SplitStore) compactFull(curTs *types.TipSet) { } if count > s.markSetSize { - s.markSetSize = count + s.markSetSize = count + count>>2 } log.Infow("marking done", "took", time.Since(startMark))