fix panic from concurrent map writes in txnRefs
This commit is contained in:
parent
6fa2cd232d
commit
36f93649ef
@ -145,11 +145,12 @@ type SplitStore struct {
|
||||
|
||||
// protection for concurrent read/writes during compaction
|
||||
txnLk sync.RWMutex
|
||||
txnActive bool
|
||||
txnEnv MarkSetEnv
|
||||
txnProtect MarkSet
|
||||
txnMarkSet MarkSet
|
||||
txnRefsMx sync.Mutex
|
||||
txnRefs map[cid.Cid]struct{}
|
||||
txnActive bool
|
||||
}
|
||||
|
||||
var _ bstore.Blockstore = (*SplitStore)(nil)
|
||||
@ -594,7 +595,9 @@ func (s *SplitStore) trackTxnRef(c cid.Cid, recursive bool) error {
|
||||
|
||||
if s.txnRefs != nil {
|
||||
// we haven't finished marking yet, so track the reference
|
||||
s.txnRefsMx.Lock()
|
||||
s.txnRefs[c] = struct{}{}
|
||||
s.txnRefsMx.Unlock()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user