-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Slowness in schema reload makes all requests on the same tidb slow #45400
Labels
affects-5.4
This bug affects 5.4.x versions.
affects-6.1
affects-6.5
affects-7.1
sig/sql-infra
SIG: SQL Infra
type/enhancement
The issue or PR belongs to an enhancement.
Comments
AndreMouche
added
the
type/enhancement
The issue or PR belongs to an enhancement.
label
Jul 17, 2023
Hi @AndreMouche, I'll take this one. |
12 tasks
This was referenced Aug 18, 2023
ti-chi-bot
added
affects-5.4
This bug affects 5.4.x versions.
affects-6.1
affects-7.1
labels
Sep 15, 2023
/sig sql-infra |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
affects-5.4
This bug affects 5.4.x versions.
affects-6.1
affects-6.5
affects-7.1
sig/sql-infra
SIG: SQL Infra
type/enhancement
The issue or PR belongs to an enhancement.
Enhancement
When TiKV restarts, the latency increases due to the shared
lock
betweenexpiredTimeStamp4PC
andload-schema
.The related issue #45385 that if
Load infoschema operation in domain takes a long time
, then it may blockthe compile process
, then makes the request on this tidb slow.more details:
the reload process locks a mutex https://github.com/pingcap/tidb/blob/v6.5.0/domain/domain.go#L455.
however, the compile process calls
Optimize
https://github.com/pingcap/tidb/blob/v6.5.0/executor/compiler.go#L116, thenOptimizeExecStmt
https://github.com/pingcap/tidb/blob/v6.5.0/planner/optimize.go#L129, then callsGetPlanFromSessionPlanCache
https://github.com/pingcap/tidb/blob/v6.5.0/planner/optimize.go#L439, thenplanCachePreprocess
https://github.com/pingcap/tidb/blob/v6.5.0/planner/core/plan_cache.go#L118, thenExpiredTimeStamp4PC
https://github.com/pingcap/tidb/blob/v6.5.0/planner/core/plan_cache.go#L102, which eventually reaches https://github.com/pingcap/tidb/blob/v6.5.0/domain/domain.go#L395thus a slow batch-get request about the shcema version would block all requests on the same tidb, which doesn't make sense, particularly, the lock https://github.com/pingcap/tidb/blob/v6.5.0/domain/domain.go#L394-L407 doesn't need to be the same as the one used in
Reload
using v6.5.0 as an example, the the issue applies to master as well.
The text was updated successfully, but these errors were encountered: