executor: add syntax 'ADMIN SHOW DDL JOB QUERIES LIMIT m OFFSET n' to retrieve DDL commands within a certain range#36480
Conversation
Master was merged into branch issue36198, and issue36198 needs to be updated.
|
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. DetailsReviewer can indicate their review by submitting an approval review. |
|
/cc @Defined2014 @xhebox |
|
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/b58a4b9f905bb5faaf5fc752d3609ace616a48d1 |
Defined2014
left a comment
There was a problem hiding this comment.
LGTM. The behavior is not the same as before,
You can only search the running DDL job corresponding to job_id within the last ten results in the DDL history job queue.
So, don't forget update docs.
https://docs.pingcap.com/zh/tidb/stable/sql-statement-admin-show-ddl
|
/merge |
|
This pull request has been accepted and is ready to merge. DetailsCommit hash: 5ae000f |
Copy that. |
TiDB MergeCI notify
|
What problem does this PR solve?
Issue Number: close #36198
Problem Summary:
https://docs.pingcap.com/tidb/stable/sql-statement-admin-show-ddl#examples
Now the 'ADMIN SHOW DDL JOB QUERIES JOB_ID' command can only use JOB_ID to retrieve the last ten rows of DDL commands' content. Just like described in the website: 'You can only search the running DDL job corresponding to job_id within the last ten results in the DDL history job queue.'
Now I am adding a feature that the users can use commands like 'ADMIN SHOW DDL JOB QUERIES LIMIT m OFFSET n' to retrieve DDL commands' content within a certain range (n+1, n+m) that the users can assign themselves instead of only the last ten results.
What is changed and how it works?
Now the function can support 3 types of SQL commands, and the result examples can refer to:
The syntax strictly conforms to the SELECT statement in MySQL:
https://dev.mysql.com/doc/refman/8.0/en/select.html
The first step of solving this issue #36198 is to transfer SQL commands to AST, which has been proposed in another PR #36285, and has been merged into master.
This PR contains changes about using AST to build plan and executor. I constructed a new struct ShowDDLJobQueriesWithRange to store limit and offset, then use the function buildShowDDLJobQueriesWithRange() to pass these information into the executor ShowDDLJobQueriesWithRangeExec. Then I implemented the Open() and Next() function for ShowDDLJobQueriesWithRangeExec.
Unit tests for these syntax are also added.
Check List
Tests
Side effects
Documentation
Release note