From 484dfaebceb8e6dd89f6b9b92e9a0eff0a08bab2 Mon Sep 17 00:00:00 2001 From: vyzo Date: Fri, 2 Jul 2021 15:32:55 +0300 Subject: [PATCH] reused cidset across all walks when flushing pending writes --- blockstore/splitstore/splitstore.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/blockstore/splitstore/splitstore.go b/blockstore/splitstore/splitstore.go index 82e98e60f..a51a48e20 100644 --- a/blockstore/splitstore/splitstore.go +++ b/blockstore/splitstore/splitstore.go @@ -593,6 +593,7 @@ func (s *SplitStore) flushPendingWrites(locked bool) { cids := make([]cid.Cid, 0, len(s.pendingWrites)) seen := make(map[cid.Cid]struct{}) + walked := cid.NewSet() for c := range s.pendingWrites { _, ok := seen[c] if ok { @@ -607,7 +608,7 @@ func (s *SplitStore) flushPendingWrites(locked bool) { continue } - err := s.walkLinks(c, cid.NewSet(), func(c cid.Cid) error { + err := s.walkLinks(c, walked, func(c cid.Cid) error { _, ok := seen[c] if !ok { cids = append(cids, c)