use walkObjectIncomplete for marking live refs

This commit is contained in:
vyzo 2022-01-31 21:41:42 +02:00
parent 877dfbe992
commit 7896af731f

View File

@ -170,7 +170,7 @@ func (s *SplitStore) protectTipSets(apply []*types.TipSet) {
} }
func (s *SplitStore) markLiveRefs(cids []cid.Cid) { func (s *SplitStore) markLiveRefs(cids []cid.Cid) {
log.Info("marking %d live refs", len(cids)) log.Infof("marking %d live refs", len(cids))
startMark := time.Now() startMark := time.Now()
workch := make(chan cid.Cid, len(cids)) workch := make(chan cid.Cid, len(cids))
@ -182,7 +182,7 @@ func (s *SplitStore) markLiveRefs(cids []cid.Cid) {
count := new(int32) count := new(int32)
worker := func() error { worker := func() error {
for c := range workch { for c := range workch {
err := s.walkObject(c, newTmpVisitor(), err := s.walkObjectIncomplete(c, newTmpVisitor(),
func(c cid.Cid) error { func(c cid.Cid) error {
if isUnitaryObject(c) { if isUnitaryObject(c) {
return errStopWalk return errStopWalk
@ -199,6 +199,10 @@ func (s *SplitStore) markLiveRefs(cids []cid.Cid) {
atomic.AddInt32(count, 1) atomic.AddInt32(count, 1)
return nil return nil
},
func(missing cid.Cid) error {
log.Warnf("missing reference %s rooted at %s", missing, c)
return errStopWalk
}) })
if err != nil { if err != nil {
return err return err