From 759594d01c22a63cc920138f7c67285eea3ff051 Mon Sep 17 00:00:00 2001 From: vyzo Date: Tue, 13 Jul 2021 03:11:40 +0300 Subject: [PATCH] always return the waitgroup in protectView so that we preclude the following scenario: Start compaction. Start view. Finish compaction. Start compaction. which would not wait for the view to complete. --- blockstore/splitstore/splitstore.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/blockstore/splitstore/splitstore.go b/blockstore/splitstore/splitstore.go index f089b3987..90ebbffcd 100644 --- a/blockstore/splitstore/splitstore.go +++ b/blockstore/splitstore/splitstore.go @@ -629,13 +629,12 @@ func (s *SplitStore) protectView(c cid.Cid) *sync.WaitGroup { s.txnLk.RLock() defer s.txnLk.RUnlock() - if !s.txnActive { - s.txnViews.Add(1) - return &s.txnViews + s.txnViews.Add(1) + if s.txnActive { + s.trackTxnRef(c) } - s.trackTxnRef(c) - return nil + return &s.txnViews } // transactionally protect a reference to an object