pingcap / tidb

TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. Try AI-powered Chat2Query free at : https://www.pingcap.com/tidb-serverless/
https://pingcap.com
Apache License 2.0
37.13k stars 5.83k forks source link

Support invalidating all auto_id cache in TiDB-server through HTTP API #24399

Open tangenta opened 3 years ago

tangenta commented 3 years ago

Feature Request

Is your feature request related to a problem? Please describe:

Related to #24122. This is a less automatic approach to solve the cache issue.

Describe the feature you'd like:

http://{TiDB_addr}:{status_port}/schema/cache_ids

This API only accepts the DELETE method and it will reset all the allocators in the TiDB server to drop cache IDs.

Describe alternatives you've considered:

Teachability, Documentation, Adoption, Migration Strategy:

siddontang commented 3 years ago

I think invalidate_ids is an anti-restful mode.

BTW, have we already had a SQL interface for operating IDs?

tangenta commented 3 years ago

I think invalidate_ids is an anti-restful mode.

Updated. Now it should be more restful:)

a SQL interface for operating IDs?

We do have:

alter table `t` auto_increment = 10086;

However this SQL only affects one table at a time, what we need is an API that affects the whole TiDB server.