Introduce more fine grained schema/DDL lease refresh interval
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Enhancement
When TiDB runs on attached disks in cloud, some of disks could exhibit long latency for a minute duration. In order to avoid schema lease expiration in such cases when system metadata can't be served in time, we have increased https://docs.pingcap.com/tidb/stable/tidb-configuration-file/#lease to 5 minutes. With this changes the lease refresh runs only each 2-3 minutes: https://github.com/pingcap/tidb/blob/eaa8c332711311fe6068a7cc8dc625f880797e81/pkg/domain/domain.go#L1094-L1096 as it is configured to run half of lease interval.
For this case we would prefer to keep lease refresh interval to 30 seconds (or 1/10 of the lease), so that TiDB can have a higher chance to refresh schema on time.
This approach can also help when there is a hot key collocated on the same node as system metadata or there are other problem with schema lease like cache misses due to stale reads.
Contributor guide
Assessment
This issue has not been assessed yet.