remove unused lookback constructs
This commit is contained in:
parent
095d7427ba
commit
18161fee38
@ -52,10 +52,6 @@ var (
|
|||||||
// we will walk the chain for live objects.
|
// we will walk the chain for live objects.
|
||||||
CompactionBoundary = 4 * build.Finality
|
CompactionBoundary = 4 * build.Finality
|
||||||
|
|
||||||
// CompactionLookback is the number of epochs from the current epoch at which
|
|
||||||
// we will consider marking an old block reference.
|
|
||||||
CompactionLookback = 2 * build.Finality
|
|
||||||
|
|
||||||
// SyncGapTime is the time delay from a tipset's min timestamp before we decide
|
// SyncGapTime is the time delay from a tipset's min timestamp before we decide
|
||||||
// there is a sync gap
|
// there is a sync gap
|
||||||
SyncGapTime = time.Minute
|
SyncGapTime = time.Minute
|
||||||
@ -141,14 +137,13 @@ type SplitStore struct {
|
|||||||
debug *debugLog
|
debug *debugLog
|
||||||
|
|
||||||
// transactional protection for concurrent read/writes during compaction
|
// transactional protection for concurrent read/writes during compaction
|
||||||
txnLk sync.RWMutex
|
txnLk sync.RWMutex
|
||||||
txnActive bool
|
txnActive bool
|
||||||
txnLookbackEpoch abi.ChainEpoch
|
txnViews *sync.WaitGroup
|
||||||
txnViews *sync.WaitGroup
|
txnProtect MarkSet
|
||||||
txnProtect MarkSet
|
txnRefsMx sync.Mutex
|
||||||
txnRefsMx sync.Mutex
|
txnRefs map[cid.Cid]struct{}
|
||||||
txnRefs map[cid.Cid]struct{}
|
txnMissing map[cid.Cid]struct{}
|
||||||
txnMissing map[cid.Cid]struct{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ bstore.Blockstore = (*SplitStore)(nil)
|
var _ bstore.Blockstore = (*SplitStore)(nil)
|
||||||
@ -569,7 +564,7 @@ func (s *SplitStore) HeadChange(_, apply []*types.TipSet) error {
|
|||||||
|
|
||||||
if epoch-s.baseEpoch > CompactionThreshold {
|
if epoch-s.baseEpoch > CompactionThreshold {
|
||||||
// it's time to compact -- prepare the transaction and go!
|
// it's time to compact -- prepare the transaction and go!
|
||||||
wg := s.beginTxnProtect(curTs)
|
wg := s.beginTxnProtect()
|
||||||
go func() {
|
go func() {
|
||||||
defer atomic.StoreInt32(&s.compacting, 0)
|
defer atomic.StoreInt32(&s.compacting, 0)
|
||||||
defer s.endTxnProtect()
|
defer s.endTxnProtect()
|
||||||
@ -933,9 +928,8 @@ func (s *SplitStore) compact(curTs *types.TipSet, wg *sync.WaitGroup) {
|
|||||||
func (s *SplitStore) doCompact(curTs *types.TipSet) error {
|
func (s *SplitStore) doCompact(curTs *types.TipSet) error {
|
||||||
currentEpoch := curTs.Height()
|
currentEpoch := curTs.Height()
|
||||||
boundaryEpoch := currentEpoch - CompactionBoundary
|
boundaryEpoch := currentEpoch - CompactionBoundary
|
||||||
lookbackEpoch := currentEpoch - CompactionLookback
|
|
||||||
|
|
||||||
log.Infow("running compaction", "currentEpoch", currentEpoch, "baseEpoch", s.baseEpoch, "boundaryEpoch", boundaryEpoch, "lookbackEpoch", lookbackEpoch)
|
log.Infow("running compaction", "currentEpoch", currentEpoch, "baseEpoch", s.baseEpoch, "boundaryEpoch", boundaryEpoch)
|
||||||
|
|
||||||
markSet, err := s.markSetEnv.Create("live", s.markSetSize)
|
markSet, err := s.markSetEnv.Create("live", s.markSetSize)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -1115,15 +1109,13 @@ func (s *SplitStore) doCompact(curTs *types.TipSet) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SplitStore) beginTxnProtect(curTs *types.TipSet) *sync.WaitGroup {
|
func (s *SplitStore) beginTxnProtect() *sync.WaitGroup {
|
||||||
lookbackEpoch := curTs.Height() - CompactionLookback
|
|
||||||
log.Info("preparing compaction transaction")
|
log.Info("preparing compaction transaction")
|
||||||
|
|
||||||
s.txnLk.Lock()
|
s.txnLk.Lock()
|
||||||
defer s.txnLk.Unlock()
|
defer s.txnLk.Unlock()
|
||||||
|
|
||||||
s.txnActive = true
|
s.txnActive = true
|
||||||
s.txnLookbackEpoch = lookbackEpoch
|
|
||||||
s.txnRefs = make(map[cid.Cid]struct{})
|
s.txnRefs = make(map[cid.Cid]struct{})
|
||||||
s.txnMissing = make(map[cid.Cid]struct{})
|
s.txnMissing = make(map[cid.Cid]struct{})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user