Skip to content

Commit

Permalink
fix(share/eds): turn off eds store dagstore gc by default (celestiaor…
Browse files Browse the repository at this point in the history
…g#2529)

Dagstore GC performs garbage collection by reclaiming transient files of
shards that are currently available but inactive, or errored. We don't
use transient files right now, so GC is turned off by default.
  • Loading branch information
walldiss committed Aug 4, 2023
1 parent 21cb185 commit 698ca74
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions share/eds/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ const (
indexPath = "/index/"
transientsPath = "/transients/"

defaultGCInterval = time.Hour
// GC performs DAG store garbage collection by reclaiming transient files of
// shards that are currently available but inactive, or errored.
// We don't use transient files right now, so GC is turned off by default.
defaultGCInterval = 0
)

var ErrNotFound = errors.New("eds not found in store")
Expand Down Expand Up @@ -123,13 +126,16 @@ func (s *Store) Start(ctx context.Context) error {
return err
}
// start Store only if DagStore succeeds
ctx, cancel := context.WithCancel(context.Background())
runCtx, cancel := context.WithCancel(context.Background())
s.cancel = cancel
// initialize empty gc result to avoid panic on access
s.lastGCResult.Store(&dagstore.GCResult{
Shards: make(map[shard.Key]error),
})
go s.gc(ctx)

if s.gcInterval != 0 {
go s.gc(runCtx)
}
return nil
}

Expand Down

0 comments on commit 698ca74

Please sign in to comment.