-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
add an API to get total count of recursive sub nodes of one node #720
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing some import, that's why the build is failing.
final String serverPath = prependChroot(clientPath); | ||
RequestHeader h = new RequestHeader(); | ||
h.setType(ZooDefs.OpCode.getAllChildrenNumber); | ||
GetAllChildrenNumberRequest request = new GetAllChildrenNumberRequest(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to import the class GetAllChildrenNumberRequest which jute generates.
@@ -616,6 +616,14 @@ private void processEvent(Object event) { | |||
} else { | |||
cb.processResult(rc, clientPath, p.ctx, null); | |||
} | |||
} else if (p.response instanceof GetAllChildrenNumberResponse) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also need to import GetAllChildrenNumberResponse
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also need to import GetAllChildrenNumberResponse
I have added the import, and how to re-trigger the Jenkins build to check the code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also need to import GetAllChildrenNumberResponse
OK, thanks for your remind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting work.
I left some questions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comments were lost.
I suggest to:
- name the API 'countChildren'
- add a flag to ask for a recursive traversal or simply have the count without listing
- add also the async version of the method
At every push CI will retest your work. |
name the API 'countChildren'
|
When Jenkins check these parts, I change nothing but output are errors. Could you please help me to solve this? (In compile area) |
@TyqITstudent
About the build...does the build pass locally on your machine? (Use ant clean to clean up before building) |
Ok, thanks for your remind. |
@@ -50,6 +50,8 @@ | |||
|
|||
public final int getChildren = 8; | |||
|
|||
public final int getAllChildrenNumber = 20; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
20 is already taken for deleteContainer, please change it to something else (22 seems to be the first free number until 100)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I will change the number.
@TyqITstudent |
I have no time to pay attention to this issue recently. You can do whatever you want. |
Thanks for that. |
In production environment, there will be always a situation that there are a lot of recursive sub nodes of one node. We need to count total number of it.
Now, we can only use API getChildren which returns the List of first level of sub nodes. We need to iterate every sub node to get recursive sub nodes. It will cost a lot of time.
In zookeeper server side, it uses Hasp<String, DataNode> to store node. The key of the map represents the path of the node. We can iterate the map get total number of all levels of sub nodes of one node.