domain: use snapshot interface to get commit ts of schema version
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Enhancement
Currently, it's needed to get `commit_ts` of a schema version when inserting schema cache, the `mvccGetByKey` interface is used to do so. But this makes the entire schema reload process appear inconsistent. [Snapshot-related interfaces are used](https://github.com/pingcap/tidb/blob/master/pkg/domain/domain.go#L225-L230) during the reading of schema version and schema diff version, while [mvcc interfaces](https://github.com/pingcap/tidb/blob/master/pkg/domain/domain.go#L235) are used when it's necessary to read the `commit_ts of` a schema diff transaction. Moreover, during the process of using mvccGetByKey, we have already encountered the following issues leading to schema cache invalidation:
- https://github.com/pingcap/tidb/issues/47807, the region error is not handled using mvcc interfaces
- https://github.com/pingcap/tidb/issues/48281, the lock result is not handled using mvcc interfaces
Contributor guide
Assessment
This issue has not been assessed yet.