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

domain: lock error is not handled getting commit ts of schema diff key #48281

Closed
cfzjywxk opened this issue Nov 3, 2023 · 0 comments · Fixed by #48330
Closed

domain: lock error is not handled getting commit ts of schema diff key #48281

cfzjywxk opened this issue Nov 3, 2023 · 0 comments · Fixed by #48330
Labels

Comments

@cfzjywxk
Copy link
Contributor

cfzjywxk commented Nov 3, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Running stale read with concurrent DDL statements.
The cause of this issue is that the mvccGetResp may contain Write information or Lock information when there's a perwrite lock on the key. In this situation, it's needed to resolve the lock to get the actual commit_ts of the schema version. Currently, it's not handled so even though the internal transaction has been committed the mvcc get may return nothing reading the schema diff key.

2. What did you expect to see? (Required)

The stale read should use schema versions from schema cache.

3. What did you see instead (Required)

Sometimes the schema cache would be invalidated because of mvcc get error when getting commit ts of schema version.

Related debug logs

[2023/11/03 18:48:14.460 +08:00] [INFO] [ddl_worker.go:893] ["HandleDDLJobTable start commit ddl txn"] [schema-version=7542] [txn-start=445384882758352927]
[2023/11/03 18:48:14.468 +08:00] [INFO] [meta.go:398] ["get schema diff"] [v=7542] [diff="{\"version\":7542,\"type\":2,\"schema_id\":5704,\"table_id\":0,\"old_table_id\":0,\"old_schema_id\":0,\"affected_options\":null}"] []
[2023/11/03 18:48:14.468 +08:00] [INFO] [domain.go:272] ["get schema version mvcc meet lock"] [version=7542] [lock="start_ts:445384882758352927 primary:\"mDBs\\000\\000\\000\\000\\000\\372\\000\\000\\000\\000\\000\\000\\000hDB:5704\\000\\376\" short_value:\"{\\\"version\\\":7542,\\\"type\\\":2,\\\"schema_id\\\":5704,\\\"table_id\\\":0,\\\"old_table_id\\\":0,\\\"old_schema_id\\\":0,\\\"affected_options\\\":null}\" "]
[2023/11/03 18:48:14.468 +08:00] [WARN] [domain.go:196] ["failed to get schema version"] [error="There is no Write MVCC info for the schema version"] [version=7542] [startTS=445384882771460099]

4. What is your TiDB version? (Required)

v6.5.4

@ti-chi-bot ti-chi-bot bot added may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 labels Nov 3, 2023
@cfzjywxk cfzjywxk removed may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 labels Nov 3, 2023
@cfzjywxk cfzjywxk changed the title domain: lock error is not handled getting commit ts of schema version domain: lock error is not handled getting commit ts of schema diff key Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant