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.
This commit is contained in:
vyzo 2021-07-13 03:11:40 +03:00
parent df9670c58d
commit 759594d01c

View File

@ -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
if s.txnActive {
s.trackTxnRef(c)
}
s.trackTxnRef(c)
return nil
return &s.txnViews
}
// transactionally protect a reference to an object