-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
stale-read query latency 10x spike cause by information schema cache miss #53428
Comments
@lcwangchao PTAL |
run |
It doesn't matter what DDL cancels or fails, the important thing is that there is a schema version gap that causes the schema cache miss, then cause stale-read query latency 10x spike. |
Another possible cause of this problem is when
This is because |
I'd like to point out that in the new design of fast create table, the schema diff for create table could be missing. |
you mean tidb_enable_fast_create_table?, it will set diff too, but don't wait it apply |
…a version gap (pingcap#53445) close pingcap#53428 Signed-off-by: crazycs520 <crazycs520@gmail.com>
…a version gap (pingcap#53445) close pingcap#53428
…a version gap (pingcap#53445) close pingcap#53428 Signed-off-by: crazycs520 <crazycs520@gmail.com>
…a version gap (pingcap#53445) close pingcap#53428 Signed-off-by: crazycs520 <crazycs520@gmail.com>
#53620 should fix this. |
…a version gap (pingcap#53445) (pingcap#53583) (pingcap#97) close pingcap#53428 Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
I have few questions about this issue
|
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
High schema cache miss.
Related metrics:
Analyze
The schema version has 585442, 585443, and 585445, but 585444 does not exist, and there's a hole that causes schema cache misses, so TiDB needs to load snapshot schema from TiKV. Related codes are following:
tidb/infoschema/cache.go
Line 118 in 868456d
Well, Why does the schema version 585444 not exist? From the current code implementation, since
GenSchemaVersion
uses a separate transaction to generate schema version, butSetSchemaDiff
use another transaction, so ifGenSchemaVersion
transaction succeed, butSetSchemaDiff
transaction fails, then will have schema version gap in this issue.Why use two separate transactions? this change is introduced by PR: support concurrent ddl
tidb/pkg/ddl/ddl.go
Lines 448 to 453 in 5d990c6
tidb/pkg/ddl/schema_version.go
Line 358 in 851e22d
tidb/domain/domain.go
Lines 423 to 424 in 2abf83d
2. What did you expect to see? (Required)
No information schema cache miss.
3. What did you see instead (Required)
information schema cache miss then cause many operation which is load snapshot schema for stale-read query.
4. What is your TiDB version? (Required)
nightly: e1a6b1d
The text was updated successfully, but these errors were encountered: