Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: 如何拿到TiDB所有ddl操作的startTs
How to get the startTs of a batch of DDL operations in TiDB
Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: 如何拿到TiDB所有ddl操作的startTs
How to get the startTs of a batch of DDL operations in TiDB
The “num” in “admin show ddl jobs [num]” represents the most recent number of entries, and the “start_time” in the result is
Actually, what is needed is the TSO value, not the time value.
You can use the Dashboard to download the full DDL history.
Dashboard address: http://${PD_ADDR}/dashboard
This can indeed be obtained, but the DDL history in our production is too large to download. Is there a way to get the most recent batch of DDL history information, mainly including the startTs?
Add a limit, for example, to get the most recent 100 DDLs:
curl -s localhost:10080/ddl/history?limit=100 | jq '.[] | {start_ts, query}'
I tested this in the testing environment and it worked, but in the production environment, it returns empty. I think it’s because the historical DDL in the production environment is too large. We have 500,000 tables in production, and there have been many DDL modification operations in the past. Even with a limit of 100, it still doesn’t work. Is there any other way?
Testing works, but it doesn’t work in production. There might be some issues in the production environment causing the request to fail. Are there any other solutions?
Adding a limit is correct… However, there is currently a bug that causes all data to be fetched even with a limit (resulting in poor performance and potential OOM). I’ll take some time to fix it soon.
*: optimize DDL history http API, reduce memory by tiancaiamao · Pull Request #36859 · pingcap/tidb · GitHub Let’s do it!
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.