-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Description
Enhancement
currently, to avoid to get the schema version for a snapshotTs, the snapshotTs of the stale read needs to be greater than the update timestamp of the current schema version. https://github.com/pingcap/tidb/blob/master/infoschema/cache.go#L111
this behavior causes significant load issue on the single tikv node stores the schema version when DDL happens. usually the stale read will request the data from a few second up to minutes before current timestamp. this mean, when DDL happens with maxUpdatedSnapshotTS = t0, all of the stale read requests happens from t0 to t0 + t_staleness will query the data of snapshotTs before t0, thus requires to get the schema version at that snapshotTs.
one solution i could think of is to change the change the schema version request from GetRequest to VerGetRequest to obtain the corresponding timestamp for each schema version change. in this way, tidb could maintain a local map of the schema version and its commit timestamp, so that it could completely avoid the point get request for schema version on stale read code path.