more accurate stats about mark set updates

This commit is contained in:
vyzo 2021-07-03 21:56:46 +03:00
parent 6f58fdcb22
commit d79e4da7aa

View File

@ -1053,6 +1053,7 @@ func (s *SplitStore) doCompact(curTs *types.TipSet) error {
log.Info("updating mark set for hot dags") log.Info("updating mark set for hot dags")
startMark = time.Now() startMark = time.Now()
count = 0
walked := cid.NewSet() walked := cid.NewSet()
for _, c := range towalk { for _, c := range towalk {
err = s.walkLinks(c, walked, func(c cid.Cid) error { err = s.walkLinks(c, walked, func(c cid.Cid) error {
@ -1066,7 +1067,7 @@ func (s *SplitStore) doCompact(curTs *types.TipSet) error {
return errStopWalk return errStopWalk
} }
liveCnt++ count++
return markSet.Mark(c) return markSet.Mark(c)
}) })
@ -1075,7 +1076,7 @@ func (s *SplitStore) doCompact(curTs *types.TipSet) error {
} }
} }
log.Infow("updating mark set done", "took", time.Since(startMark)) log.Infow("updating mark set done", "took", time.Since(startMark), "marked", count)
// filter the candidate set for objects newly marked as hot // filter the candidate set for objects newly marked as hot
if liveCnt > 0 { if liveCnt > 0 {
@ -1087,13 +1088,13 @@ func (s *SplitStore) doCompact(curTs *types.TipSet) error {
if mark { if mark {
delete(candidates, c) delete(candidates, c)
liveCnt++
} }
} }
} }
// create the cold object list // create the cold object list
coldCnt -= liveCnt cold := make([]cid.Cid, 0, len(candidates))
cold := make([]cid.Cid, 0, coldCnt)
for c := range candidates { for c := range candidates {
cold = append(cold, c) cold = append(cold, c)
} }