Skip to content

Commit

Permalink
always return the waitgroup in protectView
Browse files Browse the repository at this point in the history
so that we preclude the following scenario:
    Start compaction.
    Start view.
    Finish compaction.
    Start compaction.

which would not wait for the view to complete.
  • Loading branch information
vyzo committed Jul 13, 2021
1 parent df9670c commit 759594d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions blockstore/splitstore/splitstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 759594d

Please sign in to comment.