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

tracing code for copr.buildCopTasks is wrong #53085

Closed
time-and-fate opened this issue May 7, 2024 · 0 comments · Fixed by #53086
Closed

tracing code for copr.buildCopTasks is wrong #53085

time-and-fate opened this issue May 7, 2024 · 0 comments · Fixed by #53086
Labels
severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@time-and-fate
Copy link
Member

time-and-fate commented May 7, 2024

Bug Report

Introduced in #40825, the tracing logic for these two parts is apparently wrong.

The StartRegion() is called after the part that needs tracing finished.

This will make the recorded time less than expected and can't cover what we want to trace.

elapsed := time.Since(start)
if elapsed > time.Millisecond*500 {
logutil.BgLogger().Warn("buildCopTasks takes too much time",
zap.Duration("elapsed", elapsed),
zap.Int("range len", rangesLen),
zap.Int("task len", len(tasks)))
}
if elapsed > time.Millisecond {
defer tracing.StartRegion(bo.GetCtx(), "copr.buildCopTasks").End()
}
if opt.elapsed != nil {
*opt.elapsed = *opt.elapsed + elapsed
}
metrics.TxnRegionsNumHistogramWithCoprocessor.Observe(float64(builder.regionNum()))
return tasks, nil
}

@time-and-fate time-and-fate added type/bug The issue is confirmed as a bug. sig/sql-infra SIG: SQL Infra severity/moderate labels May 7, 2024
ti-chi-bot bot pushed a commit that referenced this issue May 8, 2024
terry1purcell pushed a commit to terry1purcell/tidb that referenced this issue May 17, 2024
RidRisR pushed a commit to RidRisR/tidb that referenced this issue May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant