Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove trace goroutine for dagstore wrapper #419

Merged
merged 1 commit into from
Aug 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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