protect assignment of warmup epoch with the mutex

This commit is contained in:
vyzo 2021-07-07 11:31:27 +03:00
parent 6cc2112749
commit 83c30dc4c0

View File

@ -118,8 +118,8 @@ type SplitStore struct {
cfg *Config cfg *Config
mx sync.Mutex mx sync.Mutex
baseEpoch abi.ChainEpoch warmupEpoch abi.ChainEpoch // protected by mx
warmupEpoch abi.ChainEpoch baseEpoch abi.ChainEpoch // protected by compaction lock
coldPurgeSize int coldPurgeSize int
@ -737,7 +737,9 @@ func (s *SplitStore) doWarmup(curTs *types.TipSet) error {
if err != nil { if err != nil {
return xerrors.Errorf("error saving warm up epoch: %w", err) return xerrors.Errorf("error saving warm up epoch: %w", err)
} }
s.mx.Lock()
s.warmupEpoch = epoch s.warmupEpoch = epoch
s.mx.Unlock()
return nil return nil
} }