domain: fix a bug when reloading take a long time in domain.Init (#45170) #45389
+15
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an automated cherry-pick of #45170
What problem does this PR solve?
Issue Number: close #45176
Problem Summary:
This problem should be that the load full schema takes 1min37s, that is, the lease period is exceeded, and there is no new load schema operation in the future. This error(
Information schema is out of date
) is reported when an SQL statement comes in.Because the transaction will check the validity of the schema, and the validity check, if found
txnTS
bigger thanschemaValidator.latestSchemaExpire
, will quote this wrong.What is changed and how it works?
Do a new reload to update
schemaValidator.latestSchemaExpire
, after the first reload indomain.Init
.In the future, we need to optimize the load schema operation.
Check List
Tests
Case 1
Local cluster, 1 TiDB, 1 TiKV.
Make the first reload take 50s(do sleep in function) in
domain.Init
for master branch as test master.Before this PR:
Upgrade from v6.5.2 to test master, failed to upgrade due to
Information schema is out of date
.After this PR:
Upgrade from v6.5.2 to test master, successful to upgrade.
Case 2
Benchbot cluster, 1 TiDB, 3 TiKV.
Make the first reload take 54s(create 500,000 tables ) in
domain.Init
for master branch as test master.Before this PR:
Upgrade from v6.5.2 to test master, failed to upgrade due to
Information schema is out of date
.After this PR:
Upgrade from v6.5.2 to test master, successful to upgrade.
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.