Skip to content

Show procedures #15892

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Show procedures #15892

wants to merge 5 commits into from

Conversation

glutouny
Copy link

@glutouny glutouny commented Jul 9, 2025

This PR mainly adds the Show Procedures feature:

  1. This query SQL is SHOW PROCEDURES
  2. The result of this query is as follows:
    image

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, this is your first pull request in IoTDB project. Thanks for your contribution! IoTDB will be better because of you.

@glutouny
Copy link
Author

glutouny commented Jul 9, 2025

This query SQL is SHOW PROCUDURES

@jt2594838
Copy link
Contributor

jt2594838 commented Jul 9, 2025

It is a great job.

Please rename the State column to Status, because the State of a Procedure is defined otherwise.

I want to add two more columns to the result:
State: the current state of the procedure. For example, CreateRegionGroupsProcedure has four stages, and I want to know which one it is running on.
image
Progress: the progress of the current state. For example, a CreateRegionGroupsProcedure may have 10 groups to create, and it is processing the 4th one.

Since every procedure has its State, the State column should be added to all procedures (maybe as a common method in the base class).
It is not necessary to add Progress for every procedure; just add an interface to retrieve the progress of a procedure, and the default message can be "Progress Not Implemented."

2. Add two more columns to the result:State、Progress
@jt2594838
Copy link
Contributor

Could you please provide a screenshot with the newest columns?

@glutouny
Copy link
Author

image @jt2594838 this is a screenshot with the newest columns.

@jt2594838
Copy link
Contributor

One last thing, could you add an integration test for this?
Maybe you can start a thread creating timeseries constantly, until another thread sees any of them via SHOW PROCEDURES.

@liyuheng55555
Copy link
Collaborator

liyuheng55555 commented Jul 14, 2025

Hello @glutouny, glad to see this PR! I’ve just started reviewing it.

So far, I feel that the ClassName column doesn’t need to use the full path—just keeping the final class name is enough, such as CreateRegionGroupsProcedure instead of org.apache....CreateRegionGroupsProcedure

Copy link
Collaborator

@liyuheng55555 liyuheng55555 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL

@@ -64,7 +64,7 @@ ddlStatement
| showVariables | showCluster | showRegions | showDataNodes | showConfigNodes | showClusterId
| getRegionId | getTimeSlotList | countTimeSlotList | getSeriesSlotList
| migrateRegion | reconstructRegion | extendRegion | removeRegion | removeDataNode | removeConfigNode
| verifyConnection
| verifyConnection | showProcedures
Copy link
Collaborator

@liyuheng55555 liyuheng55555 Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe move this define to line 64, stay with other SHOW statement?

Comment on lines +2135 to +2143
Procedure<ConfigNodeProcedureEnv> procedure = procedureEntry.getValue();
procedureInfo.setProcId(procedureEntry.getKey());
procedureInfo.setStatus(procedure.getState().name());
procedureInfo.setSubmittedTime(procedure.getSubmittedTime());
procedureInfo.setLastUpdate(procedure.getLastUpdate());
procedureInfo.setParentProcId(procedure.getParentProcId());
procedureInfo.setClassName(procedure.getClass().getName());
procedureInfo.setState(procedure.getCurrentStateForDisplay());
procedureInfo.setProgress(procedure.getProgressForDisplay());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a function like toTProcedureInfo() to Procedure.java ?

Comment on lines +459 to +464
protected IConfigTask visitShowProcedures(
final ShowProcedures showProceduresStatement, final MPPQueryContext context) {
context.setQueryType(QueryType.READ);
accessControl.checkUserIsAdmin(context.getSession().getUserName());
return new ShowProcedureTask();
}
Copy link
Collaborator

@liyuheng55555 liyuheng55555 Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other SHOW statements are generally use the MAINTAIN privilege, I suggest referring to that here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides, the privilege control of new SQL needs to add IT, take a look at the function testClusterManagementSql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants