Skip to content

Commit

Permalink
Merge pull request #419 from ipfs-force-community/fix/remove-trace-go…
Browse files Browse the repository at this point in the history
…routine

fix: remove trace goroutine for dagstore wrapper
  • Loading branch information
LinZexiao authored Aug 29, 2023
2 parents 364479f + 1b8b0b6 commit 40bd408
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions dagstore/wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ type Wrapper struct {
dagst dagstore.Interface
minerAPI MarketAPI
failureCh chan dagstore.ShardResult
traceCh chan dagstore.Trace
gcInterval time.Duration
}

Expand All @@ -69,9 +68,6 @@ func NewDAGStore(ctx context.Context,
// The dagstore will write Shard failures to the `failureCh` here.
failureCh := make(chan dagstore.ShardResult, 1)

// The dagstore will write Trace events to the `traceCh` here.
traceCh := make(chan dagstore.Trace, 32)

var (
transientsDir = filepath.Join(cfg.RootDir, "transients")
datastoreDir = filepath.Join(cfg.RootDir, "datastore")
Expand Down Expand Up @@ -110,7 +106,6 @@ func NewDAGStore(ctx context.Context,
ShardRepo: shardRepo,
MountRegistry: registry,
FailureCh: failureCh,
TraceCh: traceCh,
// not limiting fetches globally, as the Lotus mount does
// conditional throttling.
MaxConcurrentIndex: cfg.MaxConcurrentIndex,
Expand All @@ -137,7 +132,6 @@ func NewDAGStore(ctx context.Context,
dagst: dagst,
minerAPI: marketApi,
failureCh: failureCh,
traceCh: traceCh,
gcInterval: time.Duration(cfg.GCInterval),
}

Expand Down Expand Up @@ -174,10 +168,6 @@ func (w *Wrapper) Start(ctx context.Context) error {
w.backgroundWg.Add(1)
go w.gcLoop()

// run a go-routine to read the trace for debugging.
w.backgroundWg.Add(1)
go w.traceLoop()

// Run a go-routine for shard recovery
if dss, ok := w.dagst.(*dagstore.DAGStore); ok {
w.backgroundWg.Add(1)
Expand All @@ -187,24 +177,6 @@ func (w *Wrapper) Start(ctx context.Context) error {
return w.dagst.Start(ctx)
}

func (w *Wrapper) traceLoop() {
defer w.backgroundWg.Done()

for w.ctx.Err() == nil {
select {
// Log trace events from the DAG store
case tr := <-w.traceCh:
log.Debugw("trace",
"shard-key", tr.Key.String(),
"op-type", tr.Op.String(),
"after", tr.After.String())

case <-w.ctx.Done():
return
}
}
}

func (w *Wrapper) gcLoop() {
defer w.backgroundWg.Done()

Expand Down

0 comments on commit 40bd408

Please sign in to comment.