Skip to content

avoid excessive PointGet request to a single tikv node for stale read when DDL happens #40740

@hihihuhu

Description

@hihihuhu

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/enhancementThe issue or PR belongs to an enhancement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions